[py-svn] r56622 - py/branch/event/py/test2/rep/testing
hpk at codespeak.net
hpk at codespeak.net
Thu Jul 17 20:31:03 CEST 2008
Author: hpk
Date: Thu Jul 17 20:31:01 2008
New Revision: 56622
Added:
py/branch/event/py/test2/rep/testing/test_reporter_helper.py
Log:
adding some previously factored out tests
Added: py/branch/event/py/test2/rep/testing/test_reporter_helper.py
==============================================================================
--- (empty file)
+++ py/branch/event/py/test2/rep/testing/test_reporter_helper.py Thu Jul 17 20:31:01 2008
@@ -0,0 +1,37 @@
+
+import py
+
+from py.__.test2.rep.reporter import getmodpath, repr_pythonversion
+from py.__.test2.testing import setupdata
+
+def test_getmodpath_cases():
+ tmpdir = py.test.ensuretemp("test_getmodpath_cases")
+ pkgdir = tmpdir.join("pkg")
+ pkgdir.ensure("__init__.py")
+ nopkgdir = tmpdir.ensure("nopkg", dir=1)
+ def checkpkg(names, expected):
+ fcol = setupdata.getexamplecollector(names, tmpdir=pkgdir)
+ assert getmodpath(fcol) == pkgdir.basename + "." + expected
+ def checknopkg(names, expected):
+ fcol = setupdata.getexamplecollector(names, tmpdir=nopkgdir)
+ assert getmodpath(fcol) == expected
+
+ for names in (
+ 'mod.py test_f1 mod.test_f1',
+ 'mod.py TestA () test_m1 mod.TestA().test_m1',
+ 'mod.py test_g1 mod.test_g1',
+ 'mod.py test_g1 [0] mod.test_g1[0]',
+ ):
+ names = names.split()
+ expected = names.pop()
+ yield checkpkg, names, expected
+ yield checknopkg, names, expected
+
+def test_repr_python_version():
+ py.magic.patch(py.std.sys, 'version_info', (2, 5, 1, 'final', 0))
+ try:
+ assert repr_pythonversion() == "2.5.1-final-0"
+ py.std.sys.version_info = x = (2,3)
+ assert repr_pythonversion() == str(x)
+ finally:
+ py.magic.revert(py.std.sys, 'version_info')
More information about the pytest-commit
mailing list