diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99e7e3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# pyenv +.python-version + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ diff --git a/.travis.yml b/.travis.yml index 2da9b24..253320c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,115 @@ language: python -python: 2.7 -env: - - TOX_ENV=py27-pytest27 - - TOX_ENV=py27-pytest28 - - TOX_ENV=py27-pytest32 - - TOX_ENV=py27-pytest33 - - TOX_ENV=py34-pytest27 - - TOX_ENV=py34-pytest28 - - TOX_ENV=py34-pytest32 - - TOX_ENV=py34-pytest33 - # - TOX_ENV=py35-pytest27 - # - TOX_ENV=py35-pytest28 - # - TOX_ENV=py35-pytest32 - # - TOX_ENV=py35-pytest33 + +matrix: + include: + - python: 2.7 + env: TOX_ENV=py27-pytest27 + - python: 2.7 + env: TOX_ENV=py27-pytest28 + - python: 2.7 + env: TOX_ENV=py27-pytest29 + - python: 2.7 + env: TOX_ENV=py27-pytest32 + - python: 2.7 + env: TOX_ENV=py27-pytest33 + - python: 2.7 + env: TOX_ENV=py27-pytest34 + - python: 2.7 + env: TOX_ENV=py27-pytest35 + - python: 2.7 + env: TOX_ENV=py27-pytest36 + - python: 2.7 + env: TOX_ENV=py27-pytest37 + - python: 2.7 + env: TOX_ENV=py27-pytest38 + - python: 2.7 + env: TOX_ENV=py27-pytest39 + - python: 2.7 + env: TOX_ENV=py27-pytest310 + - python: 2.7 + env: TOX_ENV=py27-pytest40 + - python: 3.4 + env: TOX_ENV=py34-pytest27 + - python: 3.4 + env: TOX_ENV=py34-pytest28 + - python: 3.4 + env: TOX_ENV=py34-pytest29 + - python: 3.4 + env: TOX_ENV=py34-pytest32 + - python: 3.4 + env: TOX_ENV=py34-pytest33 + - python: 3.4 + env: TOX_ENV=py34-pytest34 + - python: 3.4 + env: TOX_ENV=py34-pytest35 + - python: 3.4 + env: TOX_ENV=py34-pytest36 + - python: 3.4 + env: TOX_ENV=py34-pytest37 + - python: 3.4 + env: TOX_ENV=py34-pytest38 + - python: 3.4 + env: TOX_ENV=py34-pytest39 + - python: 3.4 + env: TOX_ENV=py34-pytest310 + - python: 3.4 + env: TOX_ENV=py34-pytest40 + - python: 3.5 + env: TOX_ENV=py35-pytest27 + - python: 3.5 + env: TOX_ENV=py35-pytest28 + - python: 3.5 + env: TOX_ENV=py35-pytest29 + - python: 3.5 + env: TOX_ENV=py35-pytest32 + - python: 3.5 + env: TOX_ENV=py35-pytest33 + - python: 3.5 + env: TOX_ENV=py35-pytest34 + - python: 3.5 + env: TOX_ENV=py35-pytest35 + - python: 3.5 + env: TOX_ENV=py35-pytest36 + - python: 3.5 + env: TOX_ENV=py35-pytest37 + - python: 3.5 + env: TOX_ENV=py35-pytest38 + - python: 3.5 + env: TOX_ENV=py35-pytest39 + - python: 3.5 + env: TOX_ENV=py35-pytest310 + - python: 3.5 + env: TOX_ENV=py35-pytest40 + - python: 3.6 + env: TOX_ENV=py36-pytest27 + - python: 3.6 + env: TOX_ENV=py36-pytest28 + - python: 3.6 + env: TOX_ENV=py36-pytest29 + - python: 3.6 + env: TOX_ENV=py36-pytest32 + - python: 3.6 + env: TOX_ENV=py36-pytest33 + - python: 3.6 + env: TOX_ENV=py36-pytest34 + - python: 3.6 + env: TOX_ENV=py36-pytest35 + - python: 3.6 + env: TOX_ENV=py36-pytest36 + - python: 3.6 + env: TOX_ENV=py36-pytest37 + - python: 3.6 + env: TOX_ENV=py36-pytest38 + - python: 3.6 + env: TOX_ENV=py36-pytest39 + - python: 3.6 + env: TOX_ENV=py36-pytest310 + - python: 3.6 + env: TOX_ENV=py36-pytest40 + install: - pip install tox + script: - tox -e $TOX_ENV + \ No newline at end of file diff --git a/test/test_collect.py b/test/test_collect.py index e0ed4e2..d102729 100644 --- a/test/test_collect.py +++ b/test/test_collect.py @@ -25,18 +25,19 @@ def test_something(): """)) result = testdir.runpytest('--collectonly') + trimmed_result = list(map(lambda outline: outline.strip(), result.outlines)) expected_lines = [ "collected 4 items", - " ", - " ", - " ", - " ", - " ", - " ", - " ", + "", + "", + "", + "", + "", + "", + "", ] for line in expected_lines: - assert line in result.outlines + assert line in trimmed_result def test_describe_evaluated_once(testdir): diff --git a/test/test_custom_prefix.py b/test/test_custom_prefix.py index 1172df4..8c8dc4e 100644 --- a/test/test_custom_prefix.py +++ b/test/test_custom_prefix.py @@ -1,4 +1,5 @@ import py +import re pytest_plugins = 'pytester' @@ -8,19 +9,6 @@ """ -def _collect_result(result): - lines = result.stdout.lines - - # discard last line if empty - if lines[-1] == '': - lines = lines[:-1] - - # workaround for older versions of pytest not pluralizing correctly - lines = [l.replace(' 1 items', ' 1 item') for l in lines] - - return lines[-7:-2] - - def test_collect_custom_prefix(testdir): testdir.makeini(ini) @@ -34,10 +22,12 @@ def passes(): result = testdir.runpytest('--collectonly') print(result.outlines) - assert _collect_result(result) == [ - "collected 1 item", - "", - " ", - " ", - " ", + expected_lines = [ + re.compile("collected 1 item(s)?"), + re.compile("\s*"), + re.compile("\s*"), + re.compile("\s*"), + re.compile("\s*"), ] + for line in expected_lines: + assert any([line.match(r) is not None for r in result.outlines]) diff --git a/tox.ini b/tox.ini index 85285c3..f5a9002 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,24 @@ [tox] -envlist = {py27,py34,py35}-pytest{27,28} +envlist = {py27,py34,py35,py36}-pytest{27,28,29,32,33,34,35,36,37,38,39,310,40} [testenv] basepython = py27: python2.7 py34: python3.4 py35: python3.5 + py36: python3.6 deps = pytest27: pytest>=2.7,<2.8 pytest28: pytest>=2.8,<2.9 pytest29: pytest>=2.9,<2.10 pytest32: pytest>=3.2,<3.3 pytest33: pytest>=3.3,<3.4 + pytest34: pytest>=3.4,<3.5 + pytest35: pytest>=3.5,<3.6 + pytest36: pytest>=3.6,<3.7 + pytest37: pytest>=3.7,<3.8 + pytest38: pytest>=3.8,<3.9 + pytest39: pytest>=3.9,<3.10 + pytest310: pytest>=3.10,<4.0 + pytest40: pytest>=4.0,<4.1 commands = py.test -rw