[py-svn] r56623 - py/branch/event/py/test2/testing
hpk at codespeak.net
hpk at codespeak.net
Thu Jul 17 20:35:00 CEST 2008
Author: hpk
Date: Thu Jul 17 20:34:59 2008
New Revision: 56623
Removed:
py/branch/event/py/test2/testing/test_remote.py
Modified:
py/branch/event/py/test2/testing/test_session.py
Log:
merge test files, clean up
Deleted: /py/branch/event/py/test2/testing/test_remote.py
==============================================================================
--- /py/branch/event/py/test2/testing/test_remote.py Thu Jul 17 20:34:59 2008
+++ (empty file)
@@ -1,58 +0,0 @@
-import py
-
-def setup_module(mod):
- mod.tmpdir = py.test.ensuretemp(mod.__name__)
-
-class Test_Remote_Functional:
- # XXX for testing features that implicitely start new
- # we want to get access to the remote event log
- # and be able to access and assert about it it from the
- # tests below
- def test_exec(self):
- o = tmpdir.ensure('remote', dir=1)
- tfile = o.join('test_exec.py')
- tfile.write(py.code.Source("""
- def test_1():
- assert 1 == 0
- """))
- print py.std.sys.executable
- config = py.test2.config._reparse(
- ['--exec=' + py.std.sys.executable,
- o])
- session = config.initsession()
- failures = session.main()
- assert failures
- py.test.skip("extend this test to test that --exec really honores its argument")
-
- def test_looponfailing(self):
- py.test.skip("xxx check events")
- o = tmpdir.ensure('looponfailing', dir=1)
- tfile = o.join('test_looponfailing.py')
- tfile.write(py.code.Source("""
- def test_1():
- assert 1 == 0
- """))
- print py.std.sys.executable
- config = py.test2.config._reparse(['--looponfailing', str(o)])
- session = config.initsession()
- failures = session.main()
-
- cls = config._getsessionclass()
- out = py.std.Queue.Queue()
- session = cls(config, out.put)
- pool = py._thread.WorkerPool()
- reply = pool.dispatch(session.main)
- while 1:
- s = out.get(timeout=5.0)
- if s.find('1 failed') != -1:
- break
- print s
- else:
- py.test2.fail("did not see test_1 failure")
- # XXX we would like to have a cleaner way to finish
- try:
- reply.get(timeout=5.0)
- except IOError, e:
- assert str(e).lower().find('timeout') != -1
-
-
Modified: py/branch/event/py/test2/testing/test_session.py
==============================================================================
--- py/branch/event/py/test2/testing/test_session.py (original)
+++ py/branch/event/py/test2/testing/test_session.py Thu Jul 17 20:34:59 2008
@@ -275,3 +275,53 @@
assert rep.repr_failure == "custom_repr test_one"
rep = sorter.getreport("test_method_one")
assert rep.repr_failure == "custom_repr test_method_one"
+
+from py.__.test2.terminal.remote import RemoteTerminalSession
+
+class Test_TerminalRemoteSession:
+ def test_exec_leads_to_RemoteTerminalSession(self):
+ executable = py.std.sys.executable
+ config = py.test2.config._reparse(['--exec=' + executable])
+ print config
+ session = config.initsession()
+ assert isinstance(session, RemoteTerminalSession)
+ assert session.executable == executable
+
+ def test_looponfailing_leads_to_RemoteTerminalSession(self):
+ config = py.test2.config._reparse(['--looponfailing'])
+ session = config.initsession()
+ assert isinstance(session, RemoteTerminalSession)
+
+ def test_looponfailing_loops(self):
+ py.test.skip("thought needed to nicely test --looponfailing")
+ py.test.skip("xxx check events")
+ o = tmpdir.ensure('looponfailing', dir=1)
+ tfile = o.join('test_looponfailing.py')
+ tfile.write(py.code.Source("""
+ def test_1():
+ assert 1 == 0
+ """))
+ print py.std.sys.executable
+ config = py.test2.config._reparse(['--looponfailing', str(o)])
+ session = config.initsession()
+ failures = session.main()
+
+ cls = config._getsessionclass()
+ out = py.std.Queue.Queue()
+ session = cls(config, out.put)
+ pool = py._thread.WorkerPool()
+ reply = pool.dispatch(session.main)
+ while 1:
+ s = out.get(timeout=5.0)
+ if s.find('1 failed') != -1:
+ break
+ print s
+ else:
+ py.test2.fail("did not see test_1 failure")
+ # XXX we would like to have a cleaner way to finish
+ try:
+ reply.get(timeout=5.0)
+ except IOError, e:
+ assert str(e).lower().find('timeout') != -1
+
+
More information about the pytest-commit
mailing list