diff --git a/CHANGELOG b/CHANGELOG index 4d3f5ab03..800cb05e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,14 @@ -$Id: CHANGELOG 57540 2008-08-21 10:18:58Z hpk $ +$Id: CHANGELOG 57548 2008-08-21 12:12:20Z hpk $ + +Changes between 0.9.2 and 1.0 (UNRELEASED) +============================================= + +* revised internal py.test architecture +* new py.process.ForkedFunc object allowing to + fork execution of a function to a sub process + and getting a result back. + +XXX lots of things missing here XXX Changes between 0.9.1 and 0.9.2 =============================== diff --git a/py/__init__.py b/py/__init__.py index 1c94272e0..be1a1bc76 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -26,8 +26,8 @@ version = "1.0.0a1" initpkg(__name__, description = "pylib and py.test: agile development and test support library", - revision = int('$LastChangedRevision: 57540 $'.split(':')[1][:-1]), - lastchangedate = '$LastChangedDate: 2008-08-21 12:18:58 +0200 (Thu, 21 Aug 2008) $', + revision = int('$LastChangedRevision: 57548 $'.split(':')[1][:-1]), + lastchangedate = '$LastChangedDate: 2008-08-21 14:12:20 +0200 (Thu, 21 Aug 2008) $', version = version, url = "http://pylib.org", download_url = "http://codespeak.net/py/0.9.2/download.html", @@ -95,6 +95,7 @@ initpkg(__name__, 'process.__doc__' : ('./process/__init__.py', '__doc__'), 'process.cmdexec' : ('./process/cmdexec.py', 'cmdexec'), + 'process.ForkedFunc' : ('./process/forkedfunc.py', 'ForkedFunc'), # path implementation 'path.__doc__' : ('./path/__init__.py', '__doc__'), @@ -148,7 +149,6 @@ initpkg(__name__, 'io.StdCapture' : ('./io/stdcapture.py', 'StdCapture'), 'io.StdCaptureFD' : ('./io/stdcapture.py', 'StdCaptureFD'), 'io.TerminalWriter' : ('./io/terminalwriter.py', 'TerminalWriter'), - 'io.ForkedFunc' : ('./io/forkedfunc.py', 'ForkedFunc'), # error module, defining all errno's as Classes 'error' : ('./misc/error.py', 'error'), diff --git a/py/cmdline/pylookup.py b/py/cmdline/pylookup.py index 6b20b82a4..6708afbc6 100755 --- a/py/cmdline/pylookup.py +++ b/py/cmdline/pylookup.py @@ -9,7 +9,7 @@ prepended.""" import sys, os import py -from py.__.misc.terminal_helper import ansi_print, terminal_width +from py.__.io.terminalwriter import re curdir = py.path.local() diff --git a/py/io/forkedfunc.py b/py/process/forkedfunc.py similarity index 100% rename from py/io/forkedfunc.py rename to py/process/forkedfunc.py diff --git a/py/io/testing/test_forkedfunc.py b/py/process/testing/test_forkedfunc.py similarity index 84% rename from py/io/testing/test_forkedfunc.py rename to py/process/testing/test_forkedfunc.py index 4efd548d0..b3dccb44e 100644 --- a/py/io/testing/test_forkedfunc.py +++ b/py/process/testing/test_forkedfunc.py @@ -6,20 +6,20 @@ def setup_module(mod): mod.tmpdir = py.test.ensuretemp(mod.__file__) def test_waitfinish_removes_tempdir(): - ff = py.io.ForkedFunc(boxf1) + ff = py.process.ForkedFunc(boxf1) assert ff.tempdir.check() ff.waitfinish() assert not ff.tempdir.check() def test_tempdir_gets_gc_collected(): - ff = py.io.ForkedFunc(boxf1) + ff = py.process.ForkedFunc(boxf1) assert ff.tempdir.check() ff.__del__() assert not ff.tempdir.check() os.waitpid(ff.pid, 0) def test_basic_forkedfunc(): - result = py.io.ForkedFunc(boxf1).waitfinish() + result = py.process.ForkedFunc(boxf1).waitfinish() assert result.out == "some out\n" assert result.err == "some err\n" assert result.exitstatus == 0 @@ -29,7 +29,7 @@ def test_basic_forkedfunc(): def test_exitstatus(): def func(): os._exit(4) - result = py.io.ForkedFunc(func).waitfinish() + result = py.process.ForkedFunc(func).waitfinish() assert result.exitstatus == 4 assert result.signal == 0 assert not result.out @@ -38,7 +38,7 @@ def test_exitstatus(): def test_execption_in_func(): def fun(): raise ValueError(42) - ff = py.io.ForkedFunc(fun) + ff = py.process.ForkedFunc(fun) result = ff.waitfinish() assert result.exitstatus == ff.EXITSTATUS_EXCEPTION assert result.err.find("ValueError: 42") != -1 @@ -46,7 +46,7 @@ def test_execption_in_func(): assert not result.retval def test_forkedfunc_on_fds(): - result = py.io.ForkedFunc(boxf2).waitfinish() + result = py.process.ForkedFunc(boxf2).waitfinish() assert result.out == "someout" assert result.err == "someerr" assert result.exitstatus == 0 @@ -54,14 +54,14 @@ def test_forkedfunc_on_fds(): assert result.retval == 2 def test_forkedfunc_signal(): - result = py.io.ForkedFunc(boxseg).waitfinish() + result = py.process.ForkedFunc(boxseg).waitfinish() assert result.retval is None if py.std.sys.version_info < (2,4): py.test.skip("signal detection does not work with python prior 2.4") assert result.signal == 11 def test_forkedfunc_huge_data(): - result = py.io.ForkedFunc(boxhuge).waitfinish() + result = py.process.ForkedFunc(boxhuge).waitfinish() assert result.out assert result.exitstatus == 0 assert result.signal == 0 @@ -70,7 +70,7 @@ def test_forkedfunc_huge_data(): def test_box_seq(): # we run many boxes with huge data, just one after another for i in xrange(50): - result = py.io.ForkedFunc(boxhuge).waitfinish() + result = py.process.ForkedFunc(boxhuge).waitfinish() assert result.out assert result.exitstatus == 0 assert result.signal == 0 @@ -78,12 +78,12 @@ def test_box_seq(): def test_box_in_a_box(): def boxfun(): - result = py.io.ForkedFunc(boxf2).waitfinish() + result = py.process.ForkedFunc(boxf2).waitfinish() print result.out print >>sys.stderr, result.err return result.retval - result = py.io.ForkedFunc(boxfun).waitfinish() + result = py.process.ForkedFunc(boxfun).waitfinish() assert result.out == "someout\n" assert result.err == "someerr\n" assert result.exitstatus == 0 @@ -99,7 +99,7 @@ def test_kill_func_forked(): def box_fun(): time.sleep(10) # we don't want to last forever here - ff = py.io.ForkedFunc(box_fun) + ff = py.process.ForkedFunc(box_fun) os.kill(ff.pid, 15) result = ff.waitfinish() if py.std.sys.version_info < (2,4): diff --git a/py/test/runner.py b/py/test/runner.py index ccfde5134..b8c60fdb1 100644 --- a/py/test/runner.py +++ b/py/test/runner.py @@ -127,7 +127,7 @@ def forked_run_report(item, pdb=None): os._exit(EXITSTATUS_TESTEXIT) return ipickle.dumps(testrep) - ff = py.io.ForkedFunc(runforked) + ff = py.process.ForkedFunc(runforked) result = ff.waitfinish() if result.retval is not None: return ipickle.loads(result.retval)