[py-svn] commit/pytest: hpk42: fix unorderable types as reported by Ralf Schmitt
Bitbucket
commits-noreply at bitbucket.org
Wed Dec 14 11:57:38 CET 2011
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/51640a2987b4/
changeset: 51640a2987b4
user: hpk42
date: 2011-12-14 11:56:51
summary: fix unorderable types as reported by Ralf Schmitt
affected #: 7 files
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,8 @@
the good reporting and feedback. The pytest_runtest_protocol as well
as the pytest_runtest_teardown hooks now have "nextitem" available
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
----------------------------------------
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '2.2.1.dev4'
+__version__ = '2.2.1.dev5'
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -156,6 +156,7 @@
obj = obj.place_as
self._fslineno = py.code.getfslineno(obj)
+ assert isinstance(self._fslineno[1], int), obj
return self._fslineno
def reportinfo(self):
@@ -173,6 +174,7 @@
else:
fspath, lineno = self._getfslineno()
modpath = self.getmodpath()
+ assert isinstance(lineno, int)
return fspath, lineno, modpath
class PyCollectorMixin(PyobjMixin, pytest.Collector):
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
- version='2.2.1.dev4',
+ version='2.2.1.dev5',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@@ -32,7 +32,7 @@
author_email='holger at merlinux.eu',
entry_points= make_entry_points(),
# 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',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
@@ -70,4 +70,4 @@
return {'console_scripts': l}
if __name__ == '__main__':
- main()
+ main()
\ No newline at end of file
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d testing/test_python.py
--- a/testing/test_python.py
+++ b/testing/test_python.py
@@ -1517,3 +1517,20 @@
"*MyInstance*",
"*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
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d testing/test_unittest.py
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -38,7 +38,7 @@
assert self.foo2 == 1
def teardown_method(self, method):
assert 0, "42"
-
+
""")
reprec = testdir.inline_run("-s", testpath)
assert reprec.matchreport("test_both", when="call").passed
@@ -431,3 +431,20 @@
""")
res = testdir.runpytest()
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
diff -r 983a07db9c5f2830dc45475bd0ddc123ae44b00d -r 51640a2987b4ab54ca3fdeca7235e34b3c548c8d tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
indexserver=
pypi = http://pypi.python.org/simple
testrun = http://pypi.testrun.org
- default = http://pypi.testrun.org
+# default = http://pypi.testrun.org
[testenv]
changedir=testing
@@ -50,8 +50,12 @@
commands=
make html
+;;[testenv:py31]
+;;deps=:pypi:nose>=1.0
+
[testenv:py31]
-deps=:pypi:nose>=1.0
+deps=
+ {distshare}/py-1.4.6*
[testenv:py31-xdist]
deps=pytest-xdist
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list