fix unorderable types as reported by Ralf Schmitt
This commit is contained in:
parent
94e31e414a
commit
82ba764bb6
|
@ -12,6 +12,8 @@ Changes between 2.2.0 and 2.2.1.dev
|
||||||
the good reporting and feedback. The pytest_runtest_protocol as well
|
the good reporting and feedback. The pytest_runtest_protocol as well
|
||||||
as the pytest_runtest_teardown hooks now have "nextitem" available
|
as the pytest_runtest_teardown hooks now have "nextitem" available
|
||||||
which will be None indicating the end of the test run.
|
which will be None indicating the end of the test run.
|
||||||
|
- fix collection crash due to unknown-source collected items, thanks
|
||||||
|
to Ralf Schmitt (fixed by depending on a more recent pylib)
|
||||||
|
|
||||||
Changes between 2.1.3 and 2.2.0
|
Changes between 2.1.3 and 2.2.0
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#
|
#
|
||||||
__version__ = '2.2.1.dev4'
|
__version__ = '2.2.1.dev5'
|
||||||
|
|
|
@ -156,6 +156,7 @@ class PyobjMixin(object):
|
||||||
obj = obj.place_as
|
obj = obj.place_as
|
||||||
|
|
||||||
self._fslineno = py.code.getfslineno(obj)
|
self._fslineno = py.code.getfslineno(obj)
|
||||||
|
assert isinstance(self._fslineno[1], int), obj
|
||||||
return self._fslineno
|
return self._fslineno
|
||||||
|
|
||||||
def reportinfo(self):
|
def reportinfo(self):
|
||||||
|
@ -173,6 +174,7 @@ class PyobjMixin(object):
|
||||||
else:
|
else:
|
||||||
fspath, lineno = self._getfslineno()
|
fspath, lineno = self._getfslineno()
|
||||||
modpath = self.getmodpath()
|
modpath = self.getmodpath()
|
||||||
|
assert isinstance(lineno, int)
|
||||||
return fspath, lineno, modpath
|
return fspath, lineno, modpath
|
||||||
|
|
||||||
class PyCollectorMixin(PyobjMixin, pytest.Collector):
|
class PyCollectorMixin(PyobjMixin, pytest.Collector):
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -24,7 +24,7 @@ def main():
|
||||||
name='pytest',
|
name='pytest',
|
||||||
description='py.test: simple powerful testing with Python',
|
description='py.test: simple powerful testing with Python',
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
version='2.2.1.dev4',
|
version='2.2.1.dev5',
|
||||||
url='http://pytest.org',
|
url='http://pytest.org',
|
||||||
license='MIT license',
|
license='MIT license',
|
||||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||||
|
@ -32,7 +32,7 @@ def main():
|
||||||
author_email='holger at merlinux.eu',
|
author_email='holger at merlinux.eu',
|
||||||
entry_points= make_entry_points(),
|
entry_points= make_entry_points(),
|
||||||
# the following should be enabled for release
|
# the following should be enabled for release
|
||||||
install_requires=['py>=1.4.6.dev5'],
|
install_requires=['py>=1.4.6.dev6'],
|
||||||
classifiers=['Development Status :: 6 - Mature',
|
classifiers=['Development Status :: 6 - Mature',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
|
@ -70,4 +70,4 @@ def make_entry_points():
|
||||||
return {'console_scripts': l}
|
return {'console_scripts': l}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
|
@ -1517,3 +1517,20 @@ def test_customize_through_attributes(testdir):
|
||||||
"*MyInstance*",
|
"*MyInstance*",
|
||||||
"*MyFunction*test_hello*",
|
"*MyFunction*test_hello*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_unorderable_types(testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
class TestJoinEmpty:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_test():
|
||||||
|
class Test:
|
||||||
|
pass
|
||||||
|
Test.__name__ = "TestFoo"
|
||||||
|
return Test
|
||||||
|
TestFoo = make_test()
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest()
|
||||||
|
assert "TypeError" not in result.stdout.str()
|
||||||
|
assert result.ret == 0
|
||||||
|
|
|
@ -38,7 +38,7 @@ def test_setup(testdir):
|
||||||
assert self.foo2 == 1
|
assert self.foo2 == 1
|
||||||
def teardown_method(self, method):
|
def teardown_method(self, method):
|
||||||
assert 0, "42"
|
assert 0, "42"
|
||||||
|
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run("-s", testpath)
|
reprec = testdir.inline_run("-s", testpath)
|
||||||
assert reprec.matchreport("test_both", when="call").passed
|
assert reprec.matchreport("test_both", when="call").passed
|
||||||
|
@ -431,3 +431,20 @@ def test_unittest_not_shown_in_traceback(testdir):
|
||||||
""")
|
""")
|
||||||
res = testdir.runpytest()
|
res = testdir.runpytest()
|
||||||
assert "failUnlessEqual" not in res.stdout.str()
|
assert "failUnlessEqual" not in res.stdout.str()
|
||||||
|
|
||||||
|
def test_unorderable_types(testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import unittest
|
||||||
|
class TestJoinEmpty(unittest.TestCase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_test():
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
pass
|
||||||
|
Test.__name__ = "TestFoo"
|
||||||
|
return Test
|
||||||
|
TestFoo = make_test()
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest()
|
||||||
|
assert "TypeError" not in result.stdout.str()
|
||||||
|
assert result.ret == 0
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -4,7 +4,7 @@ envlist=py26,py27,py31,py32,py27-xdist,py25,py24
|
||||||
indexserver=
|
indexserver=
|
||||||
pypi = http://pypi.python.org/simple
|
pypi = http://pypi.python.org/simple
|
||||||
testrun = http://pypi.testrun.org
|
testrun = http://pypi.testrun.org
|
||||||
default = http://pypi.testrun.org
|
# default = http://pypi.testrun.org
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
changedir=testing
|
changedir=testing
|
||||||
|
@ -50,8 +50,12 @@ deps=:pypi:sphinx
|
||||||
commands=
|
commands=
|
||||||
make html
|
make html
|
||||||
|
|
||||||
|
;;[testenv:py31]
|
||||||
|
;;deps=:pypi:nose>=1.0
|
||||||
|
|
||||||
[testenv:py31]
|
[testenv:py31]
|
||||||
deps=:pypi:nose>=1.0
|
deps=
|
||||||
|
{distshare}/py-1.4.6*
|
||||||
|
|
||||||
[testenv:py31-xdist]
|
[testenv:py31-xdist]
|
||||||
deps=pytest-xdist
|
deps=pytest-xdist
|
||||||
|
|
Loading…
Reference in New Issue