[py-svn] r36253 - py/dist/py/test/rsession/testing

fijal at codespeak.net fijal at codespeak.net
Mon Jan 8 12:43:13 CET 2007


Author: fijal
Date: Mon Jan  8 12:43:09 2007
New Revision: 36253

Modified:
   py/dist/py/test/rsession/testing/test_lsession.py
   py/dist/py/test/rsession/testing/test_rsession.py
Log:
Cleanup a bit sub directories and add additional check for sub being different sub.


Modified: py/dist/py/test/rsession/testing/test_lsession.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_lsession.py	(original)
+++ py/dist/py/test/rsession/testing/test_lsession.py	Mon Jan  8 12:43:09 2007
@@ -16,7 +16,7 @@
     def example_distribution(self, runner):
         # XXX find a better way for the below 
         tmpdir = tmp
-        dirname = "sub"+runner.func_name
+        dirname = "sub_lsession"+runner.func_name
         tmpdir.ensure(dirname, "__init__.py")
         tmpdir.ensure(dirname, "test_one.py").write(py.code.Source("""
             def test_1(): 
@@ -72,8 +72,9 @@
     def test_pdb_run(self):
         # we make sure that pdb is engaged
         tmpdir = tmp
-        tmpdir.ensure("sub", "__init__.py")
-        tmpdir.ensure("sub", "test_one.py").write(py.code.Source("""
+        subdir = "sub_pdb_run"
+        tmpdir.ensure(subdir, "__init__.py")
+        tmpdir.ensure(subdir, "test_one.py").write(py.code.Source("""
             def test_1(): 
                 assert 0
         """))
@@ -83,7 +84,7 @@
             l.append(args)
         
         pdb.post_mortem = some_fun
-        args = [str(tmpdir.join("sub")), '--pdb']
+        args = [str(tmpdir.join(subdir)), '--pdb']
         config, args = py.test.Config.parse(args)
         lsession = LSession(config)
         allevents = []
@@ -102,8 +103,9 @@
         if not hasattr(py.std.os, 'fork'):
             py.test.skip('operating system not supported')
         tmpdir = tmp
-        tmpdir.ensure("sub2", "__init__.py")
-        tmpdir.ensure("sub2", "test_one.py").write(py.code.Source("""
+        subdir = "sub_lsession_minus_x"
+        tmpdir.ensure(subdir, "__init__.py")
+        tmpdir.ensure(subdir, "test_one.py").write(py.code.Source("""
             def test_1(): 
                 pass
             def test_2():
@@ -113,7 +115,7 @@
             def test_4(someargs):
                 pass
         """))
-        args = [str(tmpdir.join("sub2")), '-x']
+        args = [str(tmpdir.join(subdir)), '-x']
         config, args = py.test.Config.parse(args)
         assert config.option.exitfirst
         lsession = LSession(config)

Modified: py/dist/py/test/rsession/testing/test_rsession.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_rsession.py	(original)
+++ py/dist/py/test/rsession/testing/test_rsession.py	Mon Jan  8 12:43:09 2007
@@ -138,15 +138,15 @@
                         if isinstance(x, report.ReceivedItemOutcome)]
         assert len(testevents) == 2
 
-    def test_example_distribution(self): 
-        # XXX find a better way for the below 
-        tmpdir = py.path.local(py.__file__).dirpath().dirpath()
-        tmpdir.ensure("sub", "conftest.py").write(py.code.Source("""
+    def test_example_distribution(self):
+        subdir = "sub_example_dist"
+        tmpdir = py.test.ensuretemp("example_distribution")
+        tmpdir.ensure(subdir, "conftest.py").write(py.code.Source("""
             disthosts = [%r]
-            distrsync_roots = ["sub", "py"]
-        """ % 'localhost'))
-        tmpdir.ensure("sub", "__init__.py")
-        tmpdir.ensure("sub", "test_one.py").write(py.code.Source("""
+            distrsync_roots = ["%s"]
+        """ % ('localhost', subdir)))
+        tmpdir.ensure(subdir, "__init__.py")
+        tmpdir.ensure(subdir, "test_one.py").write(py.code.Source("""
             def test_1(): 
                 pass
             def test_2():
@@ -155,8 +155,10 @@
                 raise ValueError(23)
             def test_4(someargs):
                 pass
-        """))
-        args = [str(tmpdir.join("sub"))]
+            def test_5():
+                assert __file__ != '%s'
+        """ % str(tmpdir.join(subdir))))
+        args = [str(tmpdir.join(subdir))]
         config, args = py.test.Config.parse(args)
         rsession = RSession(config, optimise_localhost=False)
         allevents = []
@@ -167,8 +169,8 @@
         passevents = [i for i in testevents if i.outcome.passed]
         failevents = [i for i in testevents if i.outcome.excinfo]
         skippedevents = [i for i in testevents if i.outcome.skipped]
-        assert len(testevents) == 4
-        assert len(passevents) == 1
+        assert len(testevents) == 5
+        assert len(passevents) == 2
         assert len(failevents) == 3
         tb = failevents[0].outcome.excinfo.traceback
         assert tb[0].path.find("test_one") != -1



More information about the pytest-commit mailing list