Drop support to old pytest versions and test with python 3.7

This commit is contained in:
Bruno Oliveira
2018-11-10 19:31:38 -02:00
parent 74a5e0ca03
commit f9a13fe53b
8 changed files with 35 additions and 54 deletions

View File

@@ -11,18 +11,9 @@ notifications:
email: email:
- pytest-commit@python.org - pytest-commit@python.org
python: install:
- '2.7' - pip install -U pip
- '3.4' - pip install tox setuptools_scm
- '3.5'
- '3.6'
env:
- TOXENV=py-pytest30
- TOXENV=py-pytest31
- TOXENV=py-pytest32
- TOXENV=py-pytest33
install: pip install tox setuptools_scm
script: tox script: tox
stages: stages:
@@ -42,7 +33,14 @@ jobs:
env: TOXENV=py27-pytestlatest env: TOXENV=py27-pytestlatest
- stage: test - stage: test
# python x env above are already included into this stage python: "3.4"
env: TOXENV=py34-pytestlatest
- python: "3.5"
env: TOXENV=py35-pytestlatest
- python: "3.7"
env: TOXENV=py37-pytestlatest
sudo: required
dist: xenial
- python: "2.7" - python: "2.7"
env: TOXENV=py27-pytestmaster env: TOXENV=py27-pytestmaster
- python: "2.7" - python: "2.7"

View File

@@ -1,21 +1,23 @@
environment: environment:
matrix: matrix:
# note: please use "tox --listenvs" to populate the build matrix - TOXENV: "py27-pytestlatest"
- TOXENV: "py27-pytest33" - TOXENV: "py34-pytestlatest"
- TOXENV: "py34-pytest33" - TOXENV: "py35-pytestlatest"
- TOXENV: "py35-pytest33"
- TOXENV: "py36-pytest33"
- TOXENV: "py36-pytestlatest" - TOXENV: "py36-pytestlatest"
- TOXENV: "py27-pytest33-pexpect" - TOXENV: "py37-pytestlatest"
- TOXENV: "py36-pytest33-pexpect" - TOXENV: "py27-pytestmaster"
- TOXENV: "py36-pytestmaster"
- TOXENV: "py27-pytestfeatures"
- TOXENV: "py36-pytestfeatures"
install: install:
- C:\Python36\python -m pip install -U tox setuptools_scm pip - C:\Python37\python -m pip install -U pip
- C:\Python37\python -m pip install -U tox setuptools_scm
build: false # Not a C# project, build stuff at the test step instead. build: false # Not a C# project, build stuff at the test step instead.
test_script: test_script:
- C:\Python36\python -m tox - C:\Python37\python -m tox
# We don't deploy anything on tags with AppVeyor, we use Travis instead, so we # We don't deploy anything on tags with AppVeyor, we use Travis instead, so we
# might as well save resources # might as well save resources

View File

@@ -0,0 +1 @@
Pytest versions older than 3.6 are no longer supported.

View File

@@ -1,6 +1,6 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
install_requires = ["execnet>=1.1", "pytest>=3.0.0", "pytest-forked", "six"] install_requires = ["execnet>=1.1", "pytest>=3.6.0", "pytest-forked", "six"]
setup( setup(
@@ -40,5 +40,6 @@ setup(
"Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
], ],
) )

View File

@@ -708,16 +708,6 @@ def test_sub_plugins_disabled(testdir, plugin):
class TestWarnings: class TestWarnings:
@pytest.fixture(autouse=True)
def skip_if_unsupported_pytest_version(self):
"""Skip tests of this class if we are running in a pytest version which does not
support warnings yet.
"""
from pkg_resources import parse_version
if parse_version(pytest.__version__) < parse_version("3.1"):
pytest.skip("pytest warnings requires >= 3.1")
@pytest.mark.parametrize("n", ["-n0", "-n1"]) @pytest.mark.parametrize("n", ["-n0", "-n1"])
@pytest.mark.parametrize("warn_type", ["pytest", "builtin"]) @pytest.mark.parametrize("warn_type", ["pytest", "builtin"])
def test_warnings(self, testdir, n, warn_type): def test_warnings(self, testdir, n, warn_type):

View File

@@ -1,4 +1,7 @@
import py import py
import pytest
from pkg_resources import parse_version
from xdist.looponfail import RemoteControl from xdist.looponfail import RemoteControl
from xdist.looponfail import StatRecorder from xdist.looponfail import StatRecorder
@@ -214,7 +217,11 @@ class TestLooponFailing:
assert "test_one" not in remotecontrol.failures[0] assert "test_one" not in remotecontrol.failures[0]
assert "test_two" in remotecontrol.failures[0] assert "test_two" in remotecontrol.failures[0]
@py.test.mark.xfail(py.test.__version__ >= "3.1", reason="broken by pytest 3.1+") @pytest.mark.xfail(
parse_version(pytest.__version__) >= parse_version("3.1"),
reason="broken by pytest 3.1+",
strict=True,
)
def test_looponfail_removed_test(self, testdir): def test_looponfail_removed_test(self, testdir):
modcol = testdir.getmodulecol( modcol = testdir.getmodulecol(
""" """

View File

@@ -1,7 +1,6 @@
import py import py
import pprint import pprint
import pytest import pytest
from pkg_resources import parse_version
from xdist.workermanage import WorkerController, unserialize_report from xdist.workermanage import WorkerController, unserialize_report
from xdist.remote import serialize_report from xdist.remote import serialize_report
@@ -294,10 +293,6 @@ class TestWorkerInteractor:
ev = worker.popevent("workerfinished") ev = worker.popevent("workerfinished")
assert "workeroutput" in ev.kwargs assert "workeroutput" in ev.kwargs
@pytest.mark.skipif(
parse_version(pytest.__version__) < parse_version("3.3"),
reason="skip at module level illegal in this pytest version",
)
def test_remote_collect_skip(self, worker): def test_remote_collect_skip(self, worker):
worker.testdir.makepyfile( worker.testdir.makepyfile(
""" """

17
tox.ini
View File

@@ -1,30 +1,17 @@
[tox] [tox]
# if you change the envlist, please update .travis.yml file as well
envlist= envlist=
linting linting
py{27,34,35,36}-pytest{30,31,32,33,latest} py{27,34,35,36,37}-pytestlatest
py{27,36}-pytest36-pexpect
py{27,36}-pytest{master,features} py{27,36}-pytest{master,features}
[testenv] [testenv]
changedir=testing changedir=testing
passenv = USER USERNAME passenv = USER USERNAME
deps = deps =
pycmd
# to avoid .eggs
setuptools_scm
pytest30: pytest~=3.0.5
pytest31: pytest~=3.1.0
pytest32: pytest~=3.2.0
pytest33: pytest~=3.3.0
pytestlatest: pytest pytestlatest: pytest
pytestmaster: git+https://github.com/pytest-dev/pytest.git@master pytestmaster: git+https://github.com/pytest-dev/pytest.git@master
pytestfeatures: git+https://github.com/pytest-dev/pytest.git@features pytestfeatures: git+https://github.com/pytest-dev/pytest.git@features
pexpect: pexpect
filelock filelock
platform=
pexpect: linux|darwin
commands= commands=
pytest {posargs} pytest {posargs}
@@ -48,7 +35,7 @@ commands =
towncrier --version {posargs} --yes towncrier --version {posargs} --yes
[pytest] [pytest]
addopts = -rsfxX addopts = -ra
[flake8] [flake8]
max-line-length = 120 max-line-length = 120