[py-svn] r34506 - in py/dist/py/test/rsession: . testing

fijal at codespeak.net fijal at codespeak.net
Sat Nov 11 20:42:02 CET 2006


Author: fijal
Date: Sat Nov 11 20:42:00 2006
New Revision: 34506

Modified:
   py/dist/py/test/rsession/rsession.py
   py/dist/py/test/rsession/testing/test_rsession.py
Log:
Test for -x on RSession.


Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py	(original)
+++ py/dist/py/test/rsession/rsession.py	Sat Nov 11 20:42:00 2006
@@ -138,10 +138,11 @@
         except:
             remotepython = None
 
-        remote_options['nomagic'] = self.config.option.nomagic
-        remote_options['exitfirst'] = self.config.option.exitfirst
+        rem_options = RemoteOptions({})
+        rem_options['nomagic'] = self.config.option.nomagic
+        rem_options['exitfirst'] = self.config.option.exitfirst
         nodes = init_hosts(reporter, sshhosts, directories, pkgdir,
-            rsync_roots, remotepython, remote_options=remote_options.d,
+            rsync_roots, remotepython, remote_options=rem_options.d,
             optimise_localhost=self.optimise_localhost)
         reporter(report.RsyncFinished())
         

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	Sat Nov 11 20:42:00 2006
@@ -107,7 +107,34 @@
 ##        channel.send(None)
 ##        res = channel.receive()
 ##        assert res == "ok"
-    
+
+    def test_example_distribution_minus_x(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("""
+            disthosts = [%r]
+            distrsync_roots = ["sub", "py"]
+        """ % 'localhost'))
+        tmpdir.ensure("sub", "__init__.py")
+        tmpdir.ensure("sub", "test_one.py").write(py.code.Source("""
+            def test_1(): 
+                pass
+            def test_2():
+                assert 0
+            def test_3():
+                raise ValueError(23)
+            def test_4(someargs):
+                pass
+        """))
+        args = [str(tmpdir.join("sub")), "-x"]
+        config, args = py.test.Config.parse(args)
+        rsession = RSession(config)
+        allevents = []
+        rsession.main(args, reporter=allevents.append) 
+        testevents = [x for x in allevents 
+                        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()
@@ -159,7 +186,7 @@
         teardown_events = []
         
         nodes = init_hosts(setup_events.append, hosts, 'pytesttest', pkgdir,
-            rsync_roots=["py"], optimise_localhost=False)
+            rsync_roots=["py"], optimise_localhost=False, remote_options={'exitfirst':False})
         teardown_hosts(teardown_events.append, 
                        [node.channel for node in nodes], nodes)
         
@@ -183,7 +210,7 @@
         allevents = []
         
         nodes = init_hosts(allevents.append, hosts, 'pytesttest', pkgdir,
-            rsync_roots=["py"], optimise_localhost=False)
+            rsync_roots=["py"], optimise_localhost=False, remote_options={'exitfirst':False})
         
         from py.__.test.rsession.testing.test_executor \
             import ItemTestPassing, ItemTestFailing, ItemTestSkipping
@@ -222,7 +249,7 @@
         allevents = []
         hosts = ['localhost']
         nodes = init_hosts(allevents.append, hosts, 'pytesttest', pkgdir, 
-            rsync_roots=["py"], remote_options={'custom':'custom'},
+            rsync_roots=["py"], remote_options={'custom':'custom', 'exitfirst':False},
             optimise_localhost=False)
         
         rootcol = py.test.collect.Directory(pkgdir.dirpath())



More information about the pytest-commit mailing list