Merge branch 'pytest-2.7'
Conflicts: AUTHORS _pytest/__init__.py setup.py testing/conftest.py tox.ini
This commit is contained in:
commit
ee40ea5f6d
1
AUTHORS
1
AUTHORS
|
@ -26,6 +26,7 @@ Dave Hunt
|
||||||
David Mohr
|
David Mohr
|
||||||
Eduardo Schettino
|
Eduardo Schettino
|
||||||
Florian Bruhin
|
Florian Bruhin
|
||||||
|
Edison Gustavo Muenz
|
||||||
Floris Bruynooghe
|
Floris Bruynooghe
|
||||||
Graham Horler
|
Graham Horler
|
||||||
Grig Gheorghiu
|
Grig Gheorghiu
|
||||||
|
|
11
CHANGELOG
11
CHANGELOG
|
@ -68,6 +68,10 @@
|
||||||
2.7.2 (compared to 2.7.1)
|
2.7.2 (compared to 2.7.1)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
- fix issue767: pytest.raises value attribute does not contain the exception
|
||||||
|
instance on Python 2.6. Thanks Eric Siegerman for providing the test
|
||||||
|
case and Bruno Oliveira for PR.
|
||||||
|
|
||||||
- Automatically create directory for junitxml and results log.
|
- Automatically create directory for junitxml and results log.
|
||||||
Thanks Aron Curzon.
|
Thanks Aron Curzon.
|
||||||
|
|
||||||
|
@ -83,6 +87,13 @@
|
||||||
- fix issue748: unittest.SkipTest reports to internal pytest unittest plugin.
|
- fix issue748: unittest.SkipTest reports to internal pytest unittest plugin.
|
||||||
Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR.
|
Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR.
|
||||||
|
|
||||||
|
- fix issue718: failed to create representation of sets containing unsortable
|
||||||
|
elements in python 2. Thanks Edison Gustavo Muenz
|
||||||
|
|
||||||
|
- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
|
||||||
|
which has a refined algorithm for traceback generation.
|
||||||
|
|
||||||
|
|
||||||
2.7.1 (compared to 2.7.0)
|
2.7.1 (compared to 2.7.0)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
|
@ -225,10 +225,18 @@ def _compare_eq_iterable(left, right, verbose=False):
|
||||||
# dynamic import to speedup pytest
|
# dynamic import to speedup pytest
|
||||||
import difflib
|
import difflib
|
||||||
|
|
||||||
left = pprint.pformat(left).splitlines()
|
try:
|
||||||
right = pprint.pformat(right).splitlines()
|
left_formatting = pprint.pformat(left).splitlines()
|
||||||
explanation = [u('Full diff:')]
|
right_formatting = pprint.pformat(right).splitlines()
|
||||||
explanation.extend(line.strip() for line in difflib.ndiff(left, right))
|
explanation = [u('Full diff:')]
|
||||||
|
except Exception:
|
||||||
|
# hack: PrettyPrinter.pformat() in python 2 fails when formatting items that can't be sorted(), ie, calling
|
||||||
|
# sorted() on a list would raise. See issue #718.
|
||||||
|
# As a workaround, the full diff is generated by using the repr() string of each item of each container.
|
||||||
|
left_formatting = sorted(repr(x) for x in left)
|
||||||
|
right_formatting = sorted(repr(x) for x in right)
|
||||||
|
explanation = [u('Full diff (fallback to calling repr on each item):')]
|
||||||
|
explanation.extend(line.strip() for line in difflib.ndiff(left_formatting, right_formatting))
|
||||||
return explanation
|
return explanation
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1115,6 +1115,13 @@ class RaisesContext(object):
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
if tp[0] is None:
|
if tp[0] is None:
|
||||||
pytest.fail("DID NOT RAISE")
|
pytest.fail("DID NOT RAISE")
|
||||||
|
if sys.version_info < (2, 7):
|
||||||
|
# py26: on __exit__() exc_value often does not contain the
|
||||||
|
# exception value.
|
||||||
|
# http://bugs.python.org/issue7853
|
||||||
|
if not isinstance(tp[1], BaseException):
|
||||||
|
exc_type, value, traceback = tp
|
||||||
|
tp = exc_type, exc_type(value), traceback
|
||||||
self.excinfo.__init__(tp)
|
self.excinfo.__init__(tp)
|
||||||
return issubclass(self.excinfo.type, self.ExpectedException)
|
return issubclass(self.excinfo.type, self.ExpectedException)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
pytest-2.7.2: bug fixes
|
||||||
|
=======================
|
||||||
|
|
||||||
|
pytest is a mature Python testing tool with more than a 1100 tests
|
||||||
|
against itself, passing on many different interpreters and platforms.
|
||||||
|
This release is supposed to be drop-in compatible to 2.7.1.
|
||||||
|
|
||||||
|
See below for the changes and see docs at:
|
||||||
|
|
||||||
|
http://pytest.org
|
||||||
|
|
||||||
|
As usual, you can upgrade from pypi via::
|
||||||
|
|
||||||
|
pip install -U pytest
|
||||||
|
|
||||||
|
Thanks to all who contributed to this release, among them:
|
||||||
|
|
||||||
|
Bruno Oliveira
|
||||||
|
Floris Bruynooghe
|
||||||
|
Punyashloka Biswal
|
||||||
|
Aron Curzon
|
||||||
|
Benjamin Peterson
|
||||||
|
Thomas De Schampheleire
|
||||||
|
Edison Gustavo Muenz
|
||||||
|
Holger Krekel
|
||||||
|
|
||||||
|
Happy testing,
|
||||||
|
The py.test Development Team
|
||||||
|
|
||||||
|
|
||||||
|
2.7.2 (compared to 2.7.1)
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
- fix issue767: pytest.raises value attribute does not contain the exception
|
||||||
|
instance on Python 2.6. Thanks Eric Siegerman for providing the test
|
||||||
|
case and Bruno Oliveira for PR.
|
||||||
|
|
||||||
|
- Automatically create directory for junitxml and results log.
|
||||||
|
Thanks Aron Curzon.
|
||||||
|
|
||||||
|
- fix issue713: JUnit XML reports for doctest failures.
|
||||||
|
Thanks Punyashloka Biswal.
|
||||||
|
|
||||||
|
- fix issue735: assertion failures on debug versions of Python 3.4+
|
||||||
|
Thanks Benjamin Peterson.
|
||||||
|
|
||||||
|
- fix issue114: skipif marker reports to internal skipping plugin;
|
||||||
|
Thanks Floris Bruynooghe for reporting and Bruno Oliveira for the PR.
|
||||||
|
|
||||||
|
- fix issue748: unittest.SkipTest reports to internal pytest unittest plugin.
|
||||||
|
Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR.
|
||||||
|
|
||||||
|
- fix issue718: failed to create representation of sets containing unsortable
|
||||||
|
elements in python 2. Thanks Edison Gustavo Muenz
|
||||||
|
|
||||||
|
- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
|
||||||
|
which has a refined algorithm for traceback generation.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.. highlightlang:: python
|
.. highlightlang:: python
|
||||||
.. _`goodpractises`:
|
.. _`goodpractises`:
|
||||||
|
|
||||||
Good Integration Practises
|
Good Integration Practices
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
Work with virtual environments
|
Work with virtual environments
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -48,7 +48,7 @@ def has_environment_marker_support():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
install_requires = ['py>=1.4.27', 'pluggy>=0.3.0,<0.4.0']
|
install_requires = ['py>=1.4.29', 'pluggy>=0.3.0,<0.4.0']
|
||||||
extras_require = {}
|
extras_require = {}
|
||||||
if has_environment_marker_support():
|
if has_environment_marker_support():
|
||||||
extras_require[':python_version=="2.6" or python_version=="3.0" or python_version=="3.1"'] = ['argparse']
|
extras_require[':python_version=="2.6" or python_version=="3.0" or python_version=="3.1"'] = ['argparse']
|
||||||
|
|
|
@ -46,6 +46,7 @@ class TestRaises:
|
||||||
1/0
|
1/0
|
||||||
print (excinfo)
|
print (excinfo)
|
||||||
assert excinfo.type == ZeroDivisionError
|
assert excinfo.type == ZeroDivisionError
|
||||||
|
assert isinstance(excinfo.value, ZeroDivisionError)
|
||||||
|
|
||||||
def test_noraise():
|
def test_noraise():
|
||||||
with pytest.raises(pytest.raises.Exception):
|
with pytest.raises(pytest.raises.Exception):
|
||||||
|
|
|
@ -569,3 +569,39 @@ def test_AssertionError_message(testdir):
|
||||||
*assert 0, (x,y)*
|
*assert 0, (x,y)*
|
||||||
*AssertionError: (1, 2)*
|
*AssertionError: (1, 2)*
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
@pytest.mark.skipif(PY3, reason='This bug does not exist on PY3')
|
||||||
|
def test_set_with_unsortable_elements():
|
||||||
|
# issue #718
|
||||||
|
class UnsortableKey(object):
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
raise RuntimeError()
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'repr({0})'.format(self.name)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.name == other.name
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.name)
|
||||||
|
|
||||||
|
left_set = set(UnsortableKey(str(i)) for i in range(1, 3))
|
||||||
|
right_set = set(UnsortableKey(str(i)) for i in range(2, 4))
|
||||||
|
expl = callequal(left_set, right_set, verbose=True)
|
||||||
|
# skip first line because it contains the "construction" of the set, which does not have a guaranteed order
|
||||||
|
expl = expl[1:]
|
||||||
|
dedent = textwrap.dedent("""
|
||||||
|
Extra items in the left set:
|
||||||
|
repr(1)
|
||||||
|
Extra items in the right set:
|
||||||
|
repr(3)
|
||||||
|
Full diff (fallback to calling repr on each item):
|
||||||
|
- repr(1)
|
||||||
|
repr(2)
|
||||||
|
+ repr(3)
|
||||||
|
""").strip()
|
||||||
|
assert '\n'.join(expl) == dedent
|
||||||
|
|
|
@ -160,6 +160,7 @@ def test_conftest_confcutdir(testdir):
|
||||||
"""))
|
"""))
|
||||||
result = testdir.runpytest("-h", "--confcutdir=%s" % x, x)
|
result = testdir.runpytest("-h", "--confcutdir=%s" % x, x)
|
||||||
result.stdout.fnmatch_lines(["*--xyz*"])
|
result.stdout.fnmatch_lines(["*--xyz*"])
|
||||||
|
assert 'warning: could not load initial' not in result.stdout.str()
|
||||||
|
|
||||||
def test_conftest_existing_resultlog(testdir):
|
def test_conftest_existing_resultlog(testdir):
|
||||||
x = testdir.mkdir("tests")
|
x = testdir.mkdir("tests")
|
||||||
|
|
72
tox.ini
72
tox.ini
|
@ -1,10 +1,13 @@
|
||||||
[tox]
|
[tox]
|
||||||
|
minversion=2.0
|
||||||
distshare={homedir}/.tox/distshare
|
distshare={homedir}/.tox/distshare
|
||||||
envlist=flakes,py26,py27,py34,pypy,py27-pexpect,py33-pexpect,py27-nobyte,py33,py27-xdist,py33-xdist,{py27,py33}-trial,py27-subprocess,doctesting,py27-cxfreeze
|
envlist=
|
||||||
|
flakes,py26,py27,py33,py34,pypy,
|
||||||
|
{py27,py34}-{pexpect,xdist,trial},
|
||||||
|
py27-nobyte,doctesting,py27-cxfreeze
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
changedir=testing
|
commands= py.test --lsof -rfsxX {posargs:testing}
|
||||||
commands= py.test --lsof -rfsxX --junitxml={envlogdir}/junit-{envname}.xml []
|
|
||||||
deps=
|
deps=
|
||||||
nose
|
nose
|
||||||
mock
|
mock
|
||||||
|
@ -19,75 +22,59 @@ commands=
|
||||||
py.test -n3 -rfsxX --runpytest=subprocess {posargs:testing}
|
py.test -n3 -rfsxX --runpytest=subprocess {posargs:testing}
|
||||||
|
|
||||||
[testenv:genscript]
|
[testenv:genscript]
|
||||||
changedir=.
|
|
||||||
commands= py.test --genscript=pytest1
|
commands= py.test --genscript=pytest1
|
||||||
|
|
||||||
[testenv:flakes]
|
[testenv:flakes]
|
||||||
changedir=
|
|
||||||
deps = pytest-flakes>=0.2
|
deps = pytest-flakes>=0.2
|
||||||
commands = py.test --flakes -m flakes _pytest testing
|
commands = py.test --flakes -m flakes _pytest testing
|
||||||
|
|
||||||
[testenv:py27-xdist]
|
[testenv:py27-xdist]
|
||||||
changedir=.
|
|
||||||
basepython=python2.7
|
|
||||||
deps=pytest-xdist
|
deps=pytest-xdist
|
||||||
mock
|
mock
|
||||||
nose
|
nose
|
||||||
commands=
|
commands=
|
||||||
py.test -n1 -rfsxX \
|
py.test -n1 -rfsxX {posargs:testing}
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
|
|
||||||
|
|
||||||
[testenv:py33-xdist]
|
[testenv:py34-xdist]
|
||||||
changedir=.
|
|
||||||
basepython=python3.3
|
|
||||||
deps={[testenv:py27-xdist]deps}
|
deps={[testenv:py27-xdist]deps}
|
||||||
commands=
|
commands=
|
||||||
py.test -n3 -rfsxX \
|
py.test -n3 -rfsxX {posargs:testing}
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
|
|
||||||
|
|
||||||
[testenv:py27-pexpect]
|
[testenv:py27-pexpect]
|
||||||
changedir=testing
|
changedir=testing
|
||||||
basepython=python2.7
|
platform=linux|darwin
|
||||||
deps=pexpect
|
deps=pexpect
|
||||||
commands=
|
commands=
|
||||||
py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
||||||
|
|
||||||
[testenv:py33-pexpect]
|
[testenv:py34-pexpect]
|
||||||
changedir=testing
|
changedir=testing
|
||||||
basepython=python3.3
|
platform=linux|darwin
|
||||||
deps={[testenv:py27-pexpect]deps}
|
deps={[testenv:py27-pexpect]deps}
|
||||||
commands=
|
commands=
|
||||||
py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
||||||
|
|
||||||
[testenv:py27-nobyte]
|
[testenv:py27-nobyte]
|
||||||
changedir=.
|
|
||||||
basepython=python2.7
|
|
||||||
deps=pytest-xdist
|
deps=pytest-xdist
|
||||||
distribute=true
|
distribute=true
|
||||||
setenv=
|
setenv=
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
commands=
|
commands=
|
||||||
py.test -n3 -rfsxX \
|
py.test -n3 -rfsxX {posargs:testing}
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
|
|
||||||
|
|
||||||
[testenv:py27-trial]
|
[testenv:py27-trial]
|
||||||
changedir=.
|
|
||||||
basepython=python2.7
|
|
||||||
deps=twisted
|
deps=twisted
|
||||||
commands=
|
commands=
|
||||||
py.test -rsxf \
|
py.test -rsxf {posargs:testing/test_unittest.py}
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing/test_unittest.py}
|
|
||||||
|
|
||||||
[testenv:py33-trial]
|
[testenv:py34-trial]
|
||||||
changedir=.
|
# py34-trial does not work
|
||||||
basepython=python3.3
|
platform=linux|darwin
|
||||||
deps={[testenv:py27-trial]deps}
|
deps={[testenv:py27-trial]deps}
|
||||||
commands=
|
commands=
|
||||||
py.test -rsxf \
|
py.test -rsxf {posargs:testing/test_unittest.py}
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing/test_unittest.py}
|
|
||||||
|
|
||||||
[testenv:doctest]
|
[testenv:doctest]
|
||||||
changedir=.
|
|
||||||
commands=py.test --doctest-modules _pytest
|
commands=py.test --doctest-modules _pytest
|
||||||
deps=
|
deps=
|
||||||
|
|
||||||
|
@ -103,13 +90,11 @@ commands=
|
||||||
make html
|
make html
|
||||||
|
|
||||||
[testenv:doctesting]
|
[testenv:doctesting]
|
||||||
basepython=python3.3
|
|
||||||
changedir=doc/en
|
changedir=doc/en
|
||||||
deps=PyYAML
|
deps=PyYAML
|
||||||
commands= py.test -rfsxX --junitxml={envlogdir}/junit-{envname}.xml []
|
commands= py.test -rfsxX {posargs}
|
||||||
|
|
||||||
[testenv:regen]
|
[testenv:regen]
|
||||||
basepython=python3.4
|
|
||||||
changedir=doc/en
|
changedir=doc/en
|
||||||
deps=sphinx
|
deps=sphinx
|
||||||
PyYAML
|
PyYAML
|
||||||
|
@ -118,34 +103,25 @@ commands=
|
||||||
#pip install pytest==2.3.4
|
#pip install pytest==2.3.4
|
||||||
make regen
|
make regen
|
||||||
|
|
||||||
[testenv:py31]
|
|
||||||
deps=nose>=1.0
|
|
||||||
|
|
||||||
[testenv:py31-xdist]
|
|
||||||
deps=pytest-xdist
|
|
||||||
commands=
|
|
||||||
py.test -n3 -rfsxX \
|
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml []
|
|
||||||
|
|
||||||
[testenv:jython]
|
[testenv:jython]
|
||||||
changedir=testing
|
changedir=testing
|
||||||
commands=
|
commands=
|
||||||
{envpython} {envbindir}/py.test-jython \
|
{envpython} {envbindir}/py.test-jython -rfsxX {posargs}
|
||||||
-rfsxX --junitxml={envlogdir}/junit-{envname}2.xml []
|
|
||||||
|
|
||||||
[testenv:py27-cxfreeze]
|
[testenv:py27-cxfreeze]
|
||||||
changedir=testing/cx_freeze
|
changedir=testing/cx_freeze
|
||||||
basepython=python2.7
|
platform=linux|darwin
|
||||||
commands=
|
commands=
|
||||||
{envpython} install_cx_freeze.py
|
{envpython} install_cx_freeze.py
|
||||||
{envpython} runtests_setup.py build --build-exe build
|
{envpython} runtests_setup.py build --build-exe build
|
||||||
{envpython} tox_run.py
|
{envpython} tox_run.py
|
||||||
|
|
||||||
|
|
||||||
[testenv:coveralls]
|
[testenv:coveralls]
|
||||||
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
|
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
|
||||||
changedir=
|
|
||||||
usedevelop=True
|
usedevelop=True
|
||||||
basepython=python3.4
|
basepython=python3.4
|
||||||
|
changedir=testing
|
||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
coveralls
|
coveralls
|
||||||
|
@ -164,4 +140,4 @@ python_files=test_*.py *_test.py testing/*/*.py
|
||||||
python_classes=Test Acceptance
|
python_classes=Test Acceptance
|
||||||
python_functions=test
|
python_functions=test
|
||||||
pep8ignore = E401 E225 E261 E128 E124 E302
|
pep8ignore = E401 E225 E261 E128 E124 E302
|
||||||
norecursedirs = .tox ja .hg
|
norecursedirs = .tox ja .hg cx_freeze_source
|
||||||
|
|
Loading…
Reference in New Issue