From hpk at codespeak.net Fri Jan 4 19:14:11 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 4 Jan 2008 19:14:11 +0100 (CET) Subject: [py-svn] r50332 - py/branch/dist-doctest Message-ID: <20080104181411.A14C716843C@codespeak.net> Author: hpk Date: Fri Jan 4 19:14:11 2008 New Revision: 50332 Removed: py/branch/dist-doctest/ Log: remove unused branch From hpk at codespeak.net Fri Jan 4 19:20:02 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 4 Jan 2008 19:20:02 +0100 (CET) Subject: [py-svn] r50333 - py/branch/apigen Message-ID: <20080104182002.AB25A16843F@codespeak.net> Author: hpk Date: Fri Jan 4 19:20:02 2008 New Revision: 50333 Removed: py/branch/apigen/ Log: remove merged branch From hpk at codespeak.net Fri Jan 4 19:40:47 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 4 Jan 2008 19:40:47 +0100 (CET) Subject: [py-svn] r50336 - in py/branch: distributed rsession-cleanup session-cleanups test2 Message-ID: <20080104184047.B5D7B16844F@codespeak.net> Author: hpk Date: Fri Jan 4 19:40:45 2008 New Revision: 50336 Removed: py/branch/distributed/ py/branch/rsession-cleanup/ py/branch/session-cleanups/ py/branch/test2/ Log: remove more unused branches From hpk at codespeak.net Fri Jan 4 19:44:53 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 4 Jan 2008 19:44:53 +0100 (CET) Subject: [py-svn] r50337 - py/branch/session-merge Message-ID: <20080104184453.A01B016844F@codespeak.net> Author: hpk Date: Fri Jan 4 19:44:53 2008 New Revision: 50337 Removed: py/branch/session-merge/ Log: another ones bites From py-svn at codespeak.net Sat Jan 5 19:51:37 2008 From: py-svn at codespeak.net (py-svn at codespeak.net) Date: Sat, 5 Jan 2008 19:51:37 +0100 (CET) Subject: [py-svn] Your Featured Products for the Week‏ Message-ID: <20080106185138.2819.qmail@c5853.149.sinor.ru> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/py-svn/attachments/20080105/040d98c7/attachment.htm From arigo at codespeak.net Mon Jan 14 10:38:24 2008 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 14 Jan 2008 10:38:24 +0100 (CET) Subject: [py-svn] r50576 - py/trunk/py/c-extension/greenlet Message-ID: <20080114093824.2CEFD168536@codespeak.net> Author: arigo Date: Mon Jan 14 10:38:23 2008 New Revision: 50576 Added: py/trunk/py/c-extension/greenlet/switch_mips_unix.h (contents, props changed) Modified: py/trunk/py/c-extension/greenlet/slp_platformselect.h Log: This patch by Thiemo Seufer adds support for mips and mipsel. Modified: py/trunk/py/c-extension/greenlet/slp_platformselect.h ============================================================================== --- py/trunk/py/c-extension/greenlet/slp_platformselect.h (original) +++ py/trunk/py/c-extension/greenlet/slp_platformselect.h Mon Jan 14 10:38:23 2008 @@ -18,4 +18,6 @@ #include "switch_s390_unix.h" /* Linux/S390 */ #elif defined(__GNUC__) && defined(__s390x__) && defined(__linux__) #include "switch_s390_unix.h" /* Linux/S390 zSeries (identical) */ +#elif defined(__GNUC__) && defined(__mips__) && defined(__linux__) +#include "switch_mips_unix.h" /* Linux/MIPS */ #endif Added: py/trunk/py/c-extension/greenlet/switch_mips_unix.h ============================================================================== --- (empty file) +++ py/trunk/py/c-extension/greenlet/switch_mips_unix.h Mon Jan 14 10:38:23 2008 @@ -0,0 +1,56 @@ +/* + * this is the internal transfer function. + * + * HISTORY + * 05-Jan-08 Thiemo Seufer + * Ported from ppc. + */ + +#define STACK_REFPLUS 1 + +#ifdef SLP_EVAL + +#define STACK_MAGIC 0 + +#ifdef __mips64 +#define REGS_TO_SAVE "$16", "$17", "$18", "$19", "$20", "$21", "$22", \ + "$23", "$28", "$30" +#else +#define REGS_TO_SAVE "$16", "$17", "$18", "$19", "$20", "$21", "$22", \ + "$23", "$30" +#endif +static int +slp_switch(void) +{ + register int *stackref, stsizediff; + __asm__ __volatile__ ("" : : : REGS_TO_SAVE); + __asm__ ("move %0, $29" : "=r" (stackref) : ); + { + SLP_SAVE_STATE(stackref, stsizediff); + __asm__ __volatile__ ( +#ifdef __mips64 + "daddu $29, %0\n" +#else + "addu $29, %0\n" +#endif + : /* no outputs */ + : "r" (stsizediff) + ); + SLP_RESTORE_STATE(); + } + __asm__ __volatile__ ("" : : : REGS_TO_SAVE); + return 0; +} + +#endif + +/* + * further self-processing support + */ + +/* + * if you want to add self-inspection tools, place them + * here. See the x86_msvc for the necessary defines. + * These features are highly experimental und not + * essential yet. + */ From hpk at codespeak.net Mon Jan 14 17:43:08 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 14 Jan 2008 17:43:08 +0100 (CET) Subject: [py-svn] r50606 - py/trunk/py/doc Message-ID: <20080114164308.BFCBC168565@codespeak.net> Author: hpk Date: Mon Jan 14 17:43:08 2008 New Revision: 50606 Modified: py/trunk/py/doc/conftest.py Log: don't fail for links to html files where we don'T have a .txt Modified: py/trunk/py/doc/conftest.py ============================================================================== --- py/trunk/py/doc/conftest.py (original) +++ py/trunk/py/doc/conftest.py Mon Jan 14 17:43:08 2008 @@ -240,8 +240,9 @@ fn = ishtml and fn.new(ext='.txt') or fn print "filename is", fn if not fn.check(): # not ishtml or not fn.check(): - py.test.fail("reference error %r in %s:%d" %( - tryfn, path.basename, lineno+1)) + if not py.path.local(tryfn).check(): # the html could be there + py.test.fail("reference error %r in %s:%d" %( + tryfn, path.basename, lineno+1)) if anchor: source = unicode(fn.read(), 'latin1') source = source.lower().replace('-', ' ') # aehem From hpk at codespeak.net Mon Jan 14 17:43:39 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 14 Jan 2008 17:43:39 +0100 (CET) Subject: [py-svn] r50607 - py/dist/py/doc Message-ID: <20080114164339.32679168565@codespeak.net> Author: hpk Date: Mon Jan 14 17:43:38 2008 New Revision: 50607 Modified: py/dist/py/doc/conftest.py Log: html-link fix 50606 to dist Modified: py/dist/py/doc/conftest.py ============================================================================== --- py/dist/py/doc/conftest.py (original) +++ py/dist/py/doc/conftest.py Mon Jan 14 17:43:38 2008 @@ -240,8 +240,9 @@ fn = ishtml and fn.new(ext='.txt') or fn print "filename is", fn if not fn.check(): # not ishtml or not fn.check(): - py.test.fail("reference error %r in %s:%d" %( - tryfn, path.basename, lineno+1)) + if not py.path.local(tryfn).check(): # the html could be there + py.test.fail("reference error %r in %s:%d" %( + tryfn, path.basename, lineno+1)) if anchor: source = unicode(fn.read(), 'latin1') source = source.lower().replace('-', ' ') # aehem From arigo at codespeak.net Tue Jan 15 18:46:56 2008 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 15 Jan 2008 18:46:56 +0100 (CET) Subject: [py-svn] r50645 - py/trunk/py/tool Message-ID: <20080115174656.44ED5168566@codespeak.net> Author: arigo Date: Tue Jan 15 18:46:55 2008 New Revision: 50645 Modified: py/trunk/py/tool/utestconvert.py Log: Fix for "utestconvert.py < input". Modified: py/trunk/py/tool/utestconvert.py ============================================================================== --- py/trunk/py/tool/utestconvert.py (original) +++ py/trunk/py/tool/utestconvert.py Tue Jan 15 18:46:55 2008 @@ -225,7 +225,7 @@ if not args: s = '' - for block in blocksplitter(sys.stdin.read()): + for block in blocksplitter(sys.stdin): s += rewrite_utest(block) sys.stdout.write(s) From fijal at codespeak.net Fri Jan 18 17:31:09 2008 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 18 Jan 2008 17:31:09 +0100 (CET) Subject: [py-svn] r50754 - py/branch/reporter-merge/py/code Message-ID: <20080118163109.7B509169E3D@codespeak.net> Author: fijal Date: Fri Jan 18 17:31:07 2008 New Revision: 50754 Modified: py/branch/reporter-merge/py/code/source.py Log: Fix a "problem" with pypy compiler which caused py.test -A to take forever. Modified: py/branch/reporter-merge/py/code/source.py ============================================================================== --- py/branch/reporter-merge/py/code/source.py (original) +++ py/branch/reporter-merge/py/code/source.py Fri Jan 18 17:31:07 2008 @@ -109,7 +109,7 @@ for start in range(lineno, -1, -1): trylines = self.lines[start:lineno+1] # quick hack to indent the source and get it as a string in one go - trylines.insert(0, 'if 0:') + trylines.insert(0, 'def xxx():') trysource = '\n '.join(trylines) # ^ space here try: From fijal at codespeak.net Fri Jan 18 17:35:33 2008 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 18 Jan 2008 17:35:33 +0100 (CET) Subject: [py-svn] r50755 - py/trunk/py/code Message-ID: <20080118163533.6639E169E3D@codespeak.net> Author: fijal Date: Fri Jan 18 17:35:33 2008 New Revision: 50755 Modified: py/trunk/py/code/source.py Log: Port from reporter-merge branch. Modified: py/trunk/py/code/source.py ============================================================================== --- py/trunk/py/code/source.py (original) +++ py/trunk/py/code/source.py Fri Jan 18 17:35:33 2008 @@ -109,7 +109,7 @@ for start in range(lineno, -1, -1): trylines = self.lines[start:lineno+1] # quick hack to indent the source and get it as a string in one go - trylines.insert(0, 'if 0:') + trylines.insert(0, 'def xxx():') trysource = '\n '.join(trylines) # ^ space here try: From arigo at codespeak.net Fri Jan 18 17:45:56 2008 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 18 Jan 2008 17:45:56 +0100 (CET) Subject: [py-svn] r50757 - py/dist/py/code Message-ID: <20080118164556.3F7CF16855F@codespeak.net> Author: arigo Date: Fri Jan 18 17:45:55 2008 New Revision: 50757 Modified: py/dist/py/code/source.py Log: Port the r50754 bugfix. Modified: py/dist/py/code/source.py ============================================================================== --- py/dist/py/code/source.py (original) +++ py/dist/py/code/source.py Fri Jan 18 17:45:55 2008 @@ -109,7 +109,7 @@ for start in range(lineno, -1, -1): trylines = self.lines[start:lineno+1] # quick hack to indent the source and get it as a string in one go - trylines.insert(0, 'if 0:') + trylines.insert(0, 'def xxx():') trysource = '\n '.join(trylines) # ^ space here try: From py-svn at codespeak.net Tue Jan 22 00:05:37 2008 From: py-svn at codespeak.net (py-svn at codespeak.net) Date: Tue, 22 Jan 2008 00:05:37 +0100 (CET) Subject: Your Featured Products for the Weekþþ Message-ID: <20080121010531.136449.qmail@dynamic-acs-24-239-228-205.zoominternet.net> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/py-svn/attachments/20080122/9c396d63/attachment.htm From hpk at codespeak.net Wed Jan 23 11:48:27 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 23 Jan 2008 11:48:27 +0100 (CET) Subject: [py-svn] r50907 - in py/extradoc: . sprintinfo Message-ID: <20080123104827.E9C74168452@codespeak.net> Author: hpk Date: Wed Jan 23 11:48:27 2008 New Revision: 50907 Added: py/extradoc/ py/extradoc/sprintinfo/ py/extradoc/sprintinfo/pycon2008.txt Log: * start py/extradoc hierarchy * sprint planning draft Added: py/extradoc/sprintinfo/pycon2008.txt ============================================================================== --- (empty file) +++ py/extradoc/sprintinfo/pycon2008.txt Wed Jan 23 11:48:27 2008 @@ -0,0 +1,22 @@ +py.test and py lib sprint at Pycon 2008 +---------------------------------------------- + +Time: Monday, March 17th 11pm TILL Thursday, March 20th + +starting with a tutorial 17th March 11pm + +URL: http://pylib.org + +Tasks: + - XXX -- tasks depend on if 1.0 gets out before and what it contains + - writing extensions / plugins + - implementing code coverage + - packaging for win32, debian + - unifying, exploring common usage with NOSE + - improving testing support for PyPy + - XXX + +sprint leaders: + Holger Krekel (holger at merlinux.de) + Brian Dorsey (briandorsey at gmail.com) + (Maciej Fijalkowski) From hpk at codespeak.net Thu Jan 24 18:27:06 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 24 Jan 2008 18:27:06 +0100 (CET) Subject: [py-svn] r50984 - py/branch/reporter-merge/py/test Message-ID: <20080124172706.99C6716844B@codespeak.net> Author: hpk Date: Thu Jan 24 18:27:06 2008 New Revision: 50984 Modified: py/branch/reporter-merge/py/test/session.py Log: avoid reporting hooks on session object Modified: py/branch/reporter-merge/py/test/session.py ============================================================================== --- py/branch/reporter-merge/py/test/session.py (original) +++ py/branch/reporter-merge/py/test/session.py Thu Jan 24 18:27:06 2008 @@ -27,8 +27,9 @@ if not colitems: break next = colitems.pop(0) - if session: - session.start(next) + if reporter: + reporter(repevent.ItemStart(next)) + if isinstance(next, stopitems): try: next._skipbykeyword(keyword) @@ -51,8 +52,8 @@ reporter(repevent.SkippedTryiter(excinfo, next)) else: reporter(repevent.FailedTryiter(excinfo, next)) - if session: - session.finish(next) + if reporter: + reporter(repevent.ItemFinish(next)) class AbstractSession(object): """ An abstract session executes collectors/items through a runner. @@ -90,16 +91,6 @@ reporter.was_failure() return reporter, checkfun - def start(self, item): - """ A hook invoked per every item started - """ - self.reporter(repevent.ItemStart(item)) - - def finish(self, item): - """ A hook invoked per every item ending - """ - self.reporter(repevent.ItemFinish(item)) - class Session(AbstractSession): """ A Session gets test Items from Collectors, executes the From hpk at codespeak.net Thu Jan 24 18:45:22 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 24 Jan 2008 18:45:22 +0100 (CET) Subject: [py-svn] r50985 - py/branch/reporter-merge/py/doc Message-ID: <20080124174522.1B51516844C@codespeak.net> Author: hpk Date: Thu Jan 24 18:45:21 2008 New Revision: 50985 Modified: py/branch/reporter-merge/py/doc/test_conftest.py Log: fix py/doc tests after removal of getitemoutcomespairs from the session object Modified: py/branch/reporter-merge/py/doc/test_conftest.py ============================================================================== --- py/branch/reporter-merge/py/doc/test_conftest.py (original) +++ py/branch/reporter-merge/py/doc/test_conftest.py Thu Jan 24 18:45:21 2008 @@ -1,10 +1,24 @@ import py -from py.__.test.outcome import Skipped, Failed, Passed +from py.__.test import repevent def setup_module(mod): mod.tmpdir = py.test.ensuretemp('docdoctest') +def countoutcomes(session): + l = [] + session.main(l.append) + passed = failed = skipped = 0 + for event in l: + if isinstance(event, repevent.ReceivedItemOutcome): + if event.outcome.passed: + passed += 1 + elif event.outcome.skipped: + skipped += 1 + else: + failed += 1 + return failed, passed, skipped + def test_doctest_extra_exec(): # XXX get rid of the next line: py.magic.autopath().dirpath('conftest.py').copy(tmpdir.join('conftest.py')) @@ -16,9 +30,8 @@ """)) config = py.test.config._reparse([xtxt]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 1 + failed, passed, skipped = countoutcomes(session) + assert failed == 1 def test_doctest_basic(): # XXX get rid of the next line: @@ -45,12 +58,9 @@ """)) config = py.test.config._reparse([xtxt]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 0 - l = session.getitemoutcomepairs(Passed) - l2 = session.getitemoutcomepairs(Skipped) - assert len(l+l2) == 2 + failed, passed, skipped = countoutcomes(session) + assert failed == 0 + assert passed + skipped == 2 def test_deindent(): from py.__.doc.conftest import deindent @@ -69,12 +79,9 @@ ytxt.write(py.code.Source(".. >>> 1 + 1\r\n 2\r\n\r\n")) config = py.test.config._reparse([ytxt]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 0 - l = session.getitemoutcomepairs(Passed) - l2 = session.getitemoutcomepairs(Skipped) - assert len(l+l2) == 2 + failed, passed, skipped = countoutcomes(session) + assert failed == 0 + assert passed + skipped == 2 def test_doctest_indentation(): # XXX get rid of the next line: @@ -84,12 +91,9 @@ txt.write('..\n >>> print "foo\\n bar"\n foo\n bar\n') config = py.test.config._reparse([txt]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 0 - l = session.getitemoutcomepairs(Passed) - l2 = session.getitemoutcomepairs(Skipped) - assert len(l+l2) == 2 + failed, passed, skipped = countoutcomes(session) + assert failed == 0 + assert skipped + passed == 2 def test_js_ignore(): py.magic.autopath().dirpath('conftest.py').copy(tmpdir.join('conftest.py')) @@ -102,12 +106,10 @@ """)) config = py.test.config._reparse([xtxt]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 0 - l = session.getitemoutcomepairs(Passed) - l2 = session.getitemoutcomepairs(Skipped) - assert len(l+l2) == 3 + + failed, passed, skipped = countoutcomes(session) + assert failed == 0 + assert skipped + passed == 3 def test_resolve_linkrole(): from py.__.doc.conftest import get_apigen_relpath From hpk at codespeak.net Thu Jan 24 18:53:50 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 24 Jan 2008 18:53:50 +0100 (CET) Subject: [py-svn] r50986 - py/branch/reporter-merge/py/doc/example/pytest Message-ID: <20080124175350.E93C716844D@codespeak.net> Author: hpk Date: Thu Jan 24 18:53:50 2008 New Revision: 50986 Modified: py/branch/reporter-merge/py/doc/example/pytest/test_failures.py Log: refactoring test to use countoutcomes helper - it fails though: failure demo yield 21 failures not only 20 (compare it to running "py.test failure_demo.py" which does report 21 failures) Modified: py/branch/reporter-merge/py/doc/example/pytest/test_failures.py ============================================================================== --- py/branch/reporter-merge/py/doc/example/pytest/test_failures.py (original) +++ py/branch/reporter-merge/py/doc/example/pytest/test_failures.py Thu Jan 24 18:53:50 2008 @@ -1,13 +1,11 @@ import py failure_demo = py.magic.autopath().dirpath('failure_demo.py') -from py.__.test.outcome import Failed, Passed +from py.__.doc.test_conftest import countoutcomes def test_failure_demo_fails_properly(): config = py.test.config._reparse([failure_demo]) session = config.initsession() - session.main() - l = session.getitemoutcomepairs(Failed) - assert len(l) == 21 - l = session.getitemoutcomepairs(Passed) - assert not l + failed, passed, skipped = countoutcomes(session) + assert failed == 21 + assert passed == 0 From fijal at codespeak.net Fri Jan 25 12:55:07 2008 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 25 Jan 2008 12:55:07 +0100 (CET) Subject: [py-svn] r51025 - py/branch/reporter-merge/py/doc Message-ID: <20080125115507.2A88D16847A@codespeak.net> Author: fijal Date: Fri Jan 25 12:55:06 2008 New Revision: 51025 Modified: py/branch/reporter-merge/py/doc/test_conftest.py Log: Fix the test Modified: py/branch/reporter-merge/py/doc/test_conftest.py ============================================================================== --- py/branch/reporter-merge/py/doc/test_conftest.py (original) +++ py/branch/reporter-merge/py/doc/test_conftest.py Fri Jan 25 12:55:06 2008 @@ -17,6 +17,8 @@ skipped += 1 else: failed += 1 + elif isinstance(event, repevent.FailedTryiter): + failed += 1 return failed, passed, skipped def test_doctest_extra_exec(): From fijal at codespeak.net Fri Jan 25 13:00:11 2008 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 25 Jan 2008 13:00:11 +0100 (CET) Subject: [py-svn] r51026 - py/branch/reporter-merge/py/misc/testing Message-ID: <20080125120011.98998168461@codespeak.net> Author: fijal Date: Fri Jan 25 13:00:10 2008 New Revision: 51026 Modified: py/branch/reporter-merge/py/misc/testing/test_update_website.py Log: Skip those tests as apigen is turned off. Modified: py/branch/reporter-merge/py/misc/testing/test_update_website.py ============================================================================== --- py/branch/reporter-merge/py/misc/testing/test_update_website.py (original) +++ py/branch/reporter-merge/py/misc/testing/test_update_website.py Fri Jan 25 13:00:10 2008 @@ -57,6 +57,7 @@ captureouterr=True) print errors assert not errors + py.test.skip("Apigen turned off") assert pkgpath.join('../apigen').check(dir=True) assert pkgpath.join('../apigen/api/sub.foo.html').check(file=True) @@ -65,6 +66,7 @@ py.test.skip("update_website is not supposed to be run from win32") pkgpath = setup_pkg('update_website_run_tests_failure') assert not pkgpath.join('../apigen').check(dir=True) + py.test.skip("Apigen turned off") pkgpath.ensure('../apigen', file=True) errors = update_website.run_tests(pkgpath, pkgpath.dirpath().join('apigen'), From cfbolz at codespeak.net Fri Jan 25 13:46:33 2008 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 25 Jan 2008 13:46:33 +0100 (CET) Subject: [py-svn] r51029 - py/trunk/py/builtin Message-ID: <20080125124633.C5F0E1684D4@codespeak.net> Author: cfbolz Date: Fri Jan 25 13:46:31 2008 New Revision: 51029 Modified: py/trunk/py/builtin/exception.py Log: make sure the artificial GeneratorExit claims to come from the exceptions module Modified: py/trunk/py/builtin/exception.py ============================================================================== --- py/trunk/py/builtin/exception.py (original) +++ py/trunk/py/builtin/exception.py Fri Jan 25 13:46:31 2008 @@ -11,3 +11,4 @@ write code compatible with CPython 2.5 even in lower CPython versions.""" pass + GeneratorExit.__module__ = 'exceptions' From hpk at codespeak.net Fri Jan 25 14:30:54 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 25 Jan 2008 14:30:54 +0100 (CET) Subject: [py-svn] r51030 - in py/branch/reporter-merge/py/test: . terminal testing Message-ID: <20080125133054.97689168433@codespeak.net> Author: hpk Date: Fri Jan 25 14:30:54 2008 New Revision: 51030 Modified: py/branch/reporter-merge/py/test/session.py py/branch/reporter-merge/py/test/terminal/remote.py py/branch/reporter-merge/py/test/testing/test_remote.py Log: fixing test and restoring the functionality that session.main returns a list of failures (py.test --exec=python should work again) Modified: py/branch/reporter-merge/py/test/session.py ============================================================================== --- py/branch/reporter-merge/py/test/session.py (original) +++ py/branch/reporter-merge/py/test/session.py Fri Jan 25 14:30:54 2008 @@ -125,6 +125,7 @@ keyword = self.config.option.keyword reporter = self.reporter itemgenerator = itemgen(self, colitems, reporter, keyword) + failures = [] try: while 1: try: @@ -132,11 +133,15 @@ if shouldstop(): return outcome = self.run(item) + if outcome is not None: + if not outcome.passed and not outcome.skipped: + failures.append((item, outcome)) reporter(repevent.ReceivedItemOutcome(None, item, outcome)) except StopIteration: break finally: self.footer(colitems) + return failures def run(self, item): if not self.config.option.boxed: Modified: py/branch/reporter-merge/py/test/terminal/remote.py ============================================================================== --- py/branch/reporter-merge/py/test/terminal/remote.py (original) +++ py/branch/reporter-merge/py/test/terminal/remote.py Fri Jan 25 14:30:54 2008 @@ -135,7 +135,6 @@ session = config.initsession() session.shouldclose = channel.isclosed print "SLAVE: starting session.main()" - session.main() - failures = session.getitemoutcomepairs(Failed) + failures = session.main() failures = [config.get_collector_trail(item) for item,_ in failures] channel.send(failures) Modified: py/branch/reporter-merge/py/test/testing/test_remote.py ============================================================================== --- py/branch/reporter-merge/py/test/testing/test_remote.py (original) +++ py/branch/reporter-merge/py/test/testing/test_remote.py Fri Jan 25 14:30:54 2008 @@ -16,12 +16,13 @@ cls = config._getsessionclass() out = [] # out = py.std.Queue.Queue() session = cls(config, out.append) - session.main() + failures = session.main() for s in out: if s.find('1 failed') != -1: break else: - py.test.fail("did not see test_1 failure") + py.test.fail("did not see test_1 failure in output") + assert failures def test_looponfailing(self): o = tmpdir.ensure('looponfailing', dir=1) From fijal at codespeak.net Fri Jan 25 14:44:15 2008 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 25 Jan 2008 14:44:15 +0100 (CET) Subject: [py-svn] r51032 - py/branch/reporter-merge/py/green/test Message-ID: <20080125134415.0D00E168471@codespeak.net> Author: fijal Date: Fri Jan 25 14:44:12 2008 New Revision: 51032 Modified: py/branch/reporter-merge/py/green/test/test_greenexecnet.py Log: skip green execnet tests. Modified: py/branch/reporter-merge/py/green/test/test_greenexecnet.py ============================================================================== --- py/branch/reporter-merge/py/green/test/test_greenexecnet.py (original) +++ py/branch/reporter-merge/py/green/test/test_greenexecnet.py Fri Jan 25 14:44:12 2008 @@ -1,6 +1,8 @@ import py from py.__.green.greenexecnet import * +py.test.skip("Does not work with globally installed pylib") + def test_simple(): gw = PopenGateway() channel = gw.remote_exec("x = channel.receive(); channel.send(x * 6)") From hpk at codespeak.net Fri Jan 25 16:51:48 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 25 Jan 2008 16:51:48 +0100 (CET) Subject: [py-svn] r51033 - py/trunk/py/test Message-ID: <20080125155148.8655D1684E1@codespeak.net> Author: hpk Date: Fri Jan 25 16:51:46 2008 New Revision: 51033 Added: py/trunk/py/test/session.py.merge.tmp - copied, changed from r51032, py/trunk/py/test/session.py Log: merging of svn+ssh://codespeak.net/svn/py/branch/reporter-merge/py/test/session.py revisions 47584 to 51032: ------------------------------------------------------------------------ r51030 | hpk | 2008-01-25 14:30:54 +0100 (Fri, 25 Jan 2008) | 5 lines fixing test and restoring the functionality that session.main returns a list of failures (py.test --exec=python should work again) ------------------------------------------------------------------------ r50984 | hpk | 2008-01-24 18:27:06 +0100 (Thu, 24 Jan 2008) | 1 line avoid reporting hooks on session object ------------------------------------------------------------------------ r49391 | fijal | 2007-12-05 17:33:05 +0100 (Wed, 05 Dec 2007) | 2 lines Don't cache results. ------------------------------------------------------------------------ r48698 | fijal | 2007-11-15 01:31:42 +0100 (Thu, 15 Nov 2007) | 2 lines Uh. 2.4 compatibility ------------------------------------------------------------------------ r48318 | fijal | 2007-11-05 16:47:34 +0100 (Mon, 05 Nov 2007) | 3 lines Seems that --pdb don't need to imply -s and worked out of the box. I've got no idea how to test it though :-/ ------------------------------------------------------------------------ r48140 | fijal | 2007-10-28 19:43:21 +0100 (Sun, 28 Oct 2007) | 2 lines Reintroduce boxing ------------------------------------------------------------------------ r48138 | fijal | 2007-10-28 19:22:42 +0100 (Sun, 28 Oct 2007) | 2 lines Share more code. ------------------------------------------------------------------------ r48130 | fijal | 2007-10-28 14:58:42 +0100 (Sun, 28 Oct 2007) | 2 lines Add --collectonly handling, new style, logic separated ------------------------------------------------------------------------ r48129 | fijal | 2007-10-28 14:41:06 +0100 (Sun, 28 Oct 2007) | 2 lines Refactor LocalReporter not to rely on hosts being there ------------------------------------------------------------------------ r48128 | fijal | 2007-10-28 14:24:41 +0100 (Sun, 28 Oct 2007) | 2 lines Small regactoring for simple usage of default reporter class ------------------------------------------------------------------------ r48127 | fijal | 2007-10-28 12:56:41 +0100 (Sun, 28 Oct 2007) | 2 lines Remove terminal session as it's no longer needed ------------------------------------------------------------------------ r48126 | fijal | 2007-10-28 12:48:35 +0100 (Sun, 28 Oct 2007) | 2 lines Some real test for itemgen ------------------------------------------------------------------------ r47678 | fijal | 2007-10-21 18:43:54 +0200 (Sun, 21 Oct 2007) | 2 lines Make even less things working. ------------------------------------------------------------------------ r47667 | fijal | 2007-10-21 13:00:20 +0200 (Sun, 21 Oct 2007) | 4 lines Huge refactoring, the target is unification of session reporters and eventually sessions. Right now there is about 200 lines of code cut, but there is still some code to die and also some features missing :) ------------------------------------------------------------------------ r47660 | fijal | 2007-10-21 00:02:04 +0200 (Sun, 21 Oct 2007) | 2 lines Create a new branch for reporter merge ------------------------------------------------------------------------ Copied: py/trunk/py/test/session.py.merge.tmp (from r51032, py/trunk/py/test/session.py) ============================================================================== --- py/trunk/py/test/session.py (original) +++ py/trunk/py/test/session.py.merge.tmp Fri Jan 25 16:51:46 2008 @@ -1,12 +1,64 @@ import py +import sys from py.__.test.outcome import Outcome, Failed, Passed, Skipped from py.__.test.reporter import choose_reporter, TestReporter +from py.__.test import repevent +from py.__.test.outcome import SerializableOutcome, ReprOutcome +from py.__.test.reporter import LocalReporter +from py.__.test.executor import RunExecutor, BoxExecutor + +""" The session implementation - reporter version: + +* itemgen is responsible for iterating and telling reporter + about skipped and failed iterations (this is for collectors only), + this should be probably moved to session (for uniformity) +* session gets items which needs to be executed one after another + and tells reporter about that +""" + +try: + GeneratorExit +except NameError: + GeneratorExit = StopIteration # I think + +def itemgen(session, colitems, reporter, keyword=None): + stopitems = py.test.collect.Item # XXX should be generator here as well + while 1: + if not colitems: + break + next = colitems.pop(0) + if reporter: + reporter(repevent.ItemStart(next)) + + if isinstance(next, stopitems): + try: + next._skipbykeyword(keyword) + yield next + except Skipped: + if session.config.option.keyword_oneshot: + keyword = None + excinfo = py.code.ExceptionInfo() + reporter(repevent.SkippedTryiter(excinfo, next)) + else: + try: + cols = [next.join(x) for x in next.run()] + for x in itemgen(session, cols, reporter, keyword): + yield x + except (KeyboardInterrupt, SystemExit, GeneratorExit): + raise + except: + excinfo = py.code.ExceptionInfo() + if excinfo.type is Skipped: + reporter(repevent.SkippedTryiter(excinfo, next)) + else: + reporter(repevent.FailedTryiter(excinfo, next)) + if reporter: + reporter(repevent.ItemFinish(next)) class AbstractSession(object): """ An abstract session executes collectors/items through a runner. """ - def __init__(self, config): - self._memo = [] + def __init__(self, config): self.config = config self._keyword = config.option.keyword @@ -18,10 +70,6 @@ option.startserver = True if self.config.getvalue("dist_boxed") and option.dist: option.boxed = True - # implied options - if option.usepdb: - if not option.nocapture: - option.nocapture = True # conflicting options if option.looponfailing and option.usepdb: raise ValueError, "--looponfailing together with --pdb not supported." @@ -35,7 +83,8 @@ def init_reporter(self, reporter, config, hosts): if reporter is None: - reporter = choose_reporter(config)(config, hosts) + reporter = choose_reporter(self.reporterclass, config)\ + (config, hosts) else: reporter = TestReporter(reporter) checkfun = lambda : self.config.option.exitfirst and \ @@ -47,11 +96,15 @@ A Session gets test Items from Collectors, executes the Items and sends the Outcome to the Reporter. """ + reporterclass = LocalReporter + def shouldclose(self): return False def header(self, colitems): """ setup any neccessary resources ahead of the test run. """ + self.reporter(repevent.TestStarted(None, self.config, + None)) if not self.config.option.nomagic: py.magic.invoke(assertion=1) @@ -60,91 +113,46 @@ py.test.collect.Function._state.teardown_all() if not self.config.option.nomagic: py.magic.revoke(assertion=1) - - def start(self, colitem): - """ hook invoked before each colitem.run() invocation. """ - - def finish(self, colitem, outcome): - """ hook invoked after each colitem.run() invocation. """ - self._memo.append((colitem, outcome)) - - def startiteration(self, colitem, subitems): - pass - - def getitemoutcomepairs(self, cls): - return [x for x in self._memo if isinstance(x[1], cls)] - - def main(self): + self.reporter(repevent.TestFinished()) + + def main(self, reporter=None): """ main loop for running tests. """ + config = self.config + self.reporter, shouldstop = self.init_reporter(reporter, config, None) + colitems = self.config.getcolitems() + self.header(colitems) + keyword = self.config.option.keyword + reporter = self.reporter + itemgenerator = itemgen(self, colitems, reporter, keyword) + failures = [] try: - self.header(colitems) - try: + while 1: try: - for colitem in colitems: - self.runtraced(colitem) - except KeyboardInterrupt: - raise - finally: - self.footer(colitems) - except Exit, ex: - pass + item = itemgenerator.next() + if shouldstop(): + return + outcome = self.run(item) + if outcome is not None: + if not outcome.passed and not outcome.skipped: + failures.append((item, outcome)) + reporter(repevent.ReceivedItemOutcome(None, item, outcome)) + except StopIteration: + break + finally: + self.footer(colitems) + return failures return self.getitemoutcomepairs(Failed) - def runtraced(self, colitem): - if self.shouldclose(): - raise Exit, "received external close signal" - - outcome = None - colitem.startcapture() - try: - self.start(colitem) - try: - try: - if colitem._stickyfailure: - raise colitem._stickyfailure - outcome = self.run(colitem) - except (KeyboardInterrupt, Exit): - raise - except Outcome, outcome: - if outcome.excinfo is None: - outcome.excinfo = py.code.ExceptionInfo() - except: - excinfo = py.code.ExceptionInfo() - outcome = Failed(excinfo=excinfo) - assert (outcome is None or - isinstance(outcome, (list, Outcome))) - finally: - self.finish(colitem, outcome) - if isinstance(outcome, Failed) and self.config.option.exitfirst: - py.test.exit("exit on first problem configured.", item=colitem) - finally: - colitem.finishcapture() - - def run(self, colitem): - if self.config.option.collectonly and isinstance(colitem, py.test.collect.Item): - return - if isinstance(colitem, py.test.collect.Item): - colitem._skipbykeyword(self._keyword) - if self.config.option.keyword_oneshot: - self._keyword = "" - res = colitem.run() - if res is None: - return Passed() - elif not isinstance(res, (list, tuple)): - raise TypeError("%r.run() returned neither " - "list, tuple nor None: %r" % (colitem, res)) - else: - finish = self.startiteration(colitem, res) - try: - for name in res: - obj = colitem.join(name) - assert obj is not None - self.runtraced(obj) - finally: - if finish: - finish() - return res + def run(self, item): + if not self.config.option.boxed: + executor = RunExecutor(item, self.config.option.usepdb, + self.reporter, self.config) + return ReprOutcome(executor.execute().make_repr()) + else: + executor = BoxExecutor(item, self.config.option.usepdb, + self.reporter, self.config) + return ReprOutcome(executor.execute()) class Exit(Exception): """ for immediate program exits without tracebacks and reporter/summary. """ From hpk at codespeak.net Fri Jan 25 16:54:04 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 25 Jan 2008 16:54:04 +0100 (CET) Subject: [py-svn] r51034 - in py/trunk/py: . apigen doc doc/example green misc test test/rsession test/terminal test/testing Message-ID: <20080125155404.AC0CB1684D0@codespeak.net> Author: hpk Date: Fri Jan 25 16:54:04 2008 New Revision: 51034 Added: py/trunk/py/__init__.py - copied unchanged from r51033, py/branch/reporter-merge/py/__init__.py py/trunk/py/apigen/ - copied from r51033, py/branch/reporter-merge/py/apigen/ py/trunk/py/doc/example/ - copied from r51033, py/branch/reporter-merge/py/doc/example/ py/trunk/py/doc/test_conftest.py - copied unchanged from r51033, py/branch/reporter-merge/py/doc/test_conftest.py py/trunk/py/green/ - copied from r51033, py/branch/reporter-merge/py/green/ py/trunk/py/misc/ - copied from r51033, py/branch/reporter-merge/py/misc/ py/trunk/py/test/box.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/box.py py/trunk/py/test/collect.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/collect.py py/trunk/py/test/collectonly.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/collectonly.py py/trunk/py/test/config.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/config.py py/trunk/py/test/defaultconftest.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/defaultconftest.py py/trunk/py/test/executor.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/executor.py py/trunk/py/test/outcome.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/outcome.py py/trunk/py/test/repevent.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/repevent.py py/trunk/py/test/reporter.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/reporter.py py/trunk/py/test/representation.py - copied unchanged from r51033, py/branch/reporter-merge/py/test/representation.py py/trunk/py/test/rsession/ - copied from r51033, py/branch/reporter-merge/py/test/rsession/ py/trunk/py/test/session.py - copied unchanged from r51033, py/trunk/py/test/session.py.merge.tmp py/trunk/py/test/terminal/ - copied from r51033, py/branch/reporter-merge/py/test/terminal/ py/trunk/py/test/testing/ - copied from r51033, py/branch/reporter-merge/py/test/testing/ Removed: py/trunk/py/test/session.py.merge.tmp Log: merging in fijal's reporter-merge branch into the trunk, still needs refactoring as far as i am concernced. Deleted: /py/trunk/py/test/session.py.merge.tmp ============================================================================== --- /py/trunk/py/test/session.py.merge.tmp Fri Jan 25 16:54:04 2008 +++ (empty file) @@ -1,165 +0,0 @@ -import py -import sys -from py.__.test.outcome import Outcome, Failed, Passed, Skipped -from py.__.test.reporter import choose_reporter, TestReporter -from py.__.test import repevent -from py.__.test.outcome import SerializableOutcome, ReprOutcome -from py.__.test.reporter import LocalReporter -from py.__.test.executor import RunExecutor, BoxExecutor - -""" The session implementation - reporter version: - -* itemgen is responsible for iterating and telling reporter - about skipped and failed iterations (this is for collectors only), - this should be probably moved to session (for uniformity) -* session gets items which needs to be executed one after another - and tells reporter about that -""" - -try: - GeneratorExit -except NameError: - GeneratorExit = StopIteration # I think - -def itemgen(session, colitems, reporter, keyword=None): - stopitems = py.test.collect.Item # XXX should be generator here as well - while 1: - if not colitems: - break - next = colitems.pop(0) - if reporter: - reporter(repevent.ItemStart(next)) - - if isinstance(next, stopitems): - try: - next._skipbykeyword(keyword) - yield next - except Skipped: - if session.config.option.keyword_oneshot: - keyword = None - excinfo = py.code.ExceptionInfo() - reporter(repevent.SkippedTryiter(excinfo, next)) - else: - try: - cols = [next.join(x) for x in next.run()] - for x in itemgen(session, cols, reporter, keyword): - yield x - except (KeyboardInterrupt, SystemExit, GeneratorExit): - raise - except: - excinfo = py.code.ExceptionInfo() - if excinfo.type is Skipped: - reporter(repevent.SkippedTryiter(excinfo, next)) - else: - reporter(repevent.FailedTryiter(excinfo, next)) - if reporter: - reporter(repevent.ItemFinish(next)) - -class AbstractSession(object): - """ An abstract session executes collectors/items through a runner. - """ - def __init__(self, config): - self.config = config - self._keyword = config.option.keyword - - def fixoptions(self): - """ check, fix and determine conflicting options. """ - option = self.config.option - if option.runbrowser and not option.startserver: - #print "--runbrowser implies --startserver" - option.startserver = True - if self.config.getvalue("dist_boxed") and option.dist: - option.boxed = True - # conflicting options - if option.looponfailing and option.usepdb: - raise ValueError, "--looponfailing together with --pdb not supported." - if option.looponfailing and option.dist: - raise ValueError, "--looponfailing together with --dist not supported." - if option.executable and option.usepdb: - raise ValueError, "--exec together with --pdb not supported." - - if option.keyword_oneshot and not option.keyword: - raise ValueError, "--keyword-oneshot makes sense only when --keyword is supplied" - - def init_reporter(self, reporter, config, hosts): - if reporter is None: - reporter = choose_reporter(self.reporterclass, config)\ - (config, hosts) - else: - reporter = TestReporter(reporter) - checkfun = lambda : self.config.option.exitfirst and \ - reporter.was_failure() - return reporter, checkfun - -class Session(AbstractSession): - """ - A Session gets test Items from Collectors, executes the - Items and sends the Outcome to the Reporter. - """ - reporterclass = LocalReporter - - def shouldclose(self): - return False - - def header(self, colitems): - """ setup any neccessary resources ahead of the test run. """ - self.reporter(repevent.TestStarted(None, self.config, - None)) - if not self.config.option.nomagic: - py.magic.invoke(assertion=1) - - def footer(self, colitems): - """ teardown any resources after a test run. """ - py.test.collect.Function._state.teardown_all() - if not self.config.option.nomagic: - py.magic.revoke(assertion=1) - self.reporter(repevent.TestFinished()) - - def main(self, reporter=None): - """ main loop for running tests. """ - config = self.config - self.reporter, shouldstop = self.init_reporter(reporter, config, None) - - colitems = self.config.getcolitems() - self.header(colitems) - keyword = self.config.option.keyword - reporter = self.reporter - itemgenerator = itemgen(self, colitems, reporter, keyword) - failures = [] - try: - while 1: - try: - item = itemgenerator.next() - if shouldstop(): - return - outcome = self.run(item) - if outcome is not None: - if not outcome.passed and not outcome.skipped: - failures.append((item, outcome)) - reporter(repevent.ReceivedItemOutcome(None, item, outcome)) - except StopIteration: - break - finally: - self.footer(colitems) - return failures - return self.getitemoutcomepairs(Failed) - - def run(self, item): - if not self.config.option.boxed: - executor = RunExecutor(item, self.config.option.usepdb, - self.reporter, self.config) - return ReprOutcome(executor.execute().make_repr()) - else: - executor = BoxExecutor(item, self.config.option.usepdb, - self.reporter, self.config) - return ReprOutcome(executor.execute()) - -class Exit(Exception): - """ for immediate program exits without tracebacks and reporter/summary. """ - def __init__(self, msg="unknown reason", item=None): - self.msg = msg - Exception.__init__(self, msg) - -def exit(msg, item=None): - raise Exit(msg=msg, item=item) - From hpk at codespeak.net Sat Jan 26 11:58:24 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 26 Jan 2008 11:58:24 +0100 (CET) Subject: [py-svn] r51056 - py/trunk/py/green Message-ID: <20080126105824.50654168441@codespeak.net> Author: hpk Date: Sat Jan 26 11:58:23 2008 New Revision: 51056 Modified: py/trunk/py/green/conftest.py Log: fijal: don't use py.test.skip directly in a conftest.py - this will get called very early during import time. This lead to windows not executing any py/ tests at all. Modified: py/trunk/py/green/conftest.py ============================================================================== --- py/trunk/py/green/conftest.py (original) +++ py/trunk/py/green/conftest.py Sat Jan 26 11:58:23 2008 @@ -1,4 +1,8 @@ import py, os -if os.name == 'nt': - py.test.skip("Cannot test green layer on windows") +class Directory(py.test.collect.Directory): + def run(self): + if os.name == 'nt': + py.test.skip("Cannot test green layer on windows") + else: + return super(Directory, self).run() From hpk at codespeak.net Sat Jan 26 12:33:32 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 26 Jan 2008 12:33:32 +0100 (CET) Subject: [py-svn] r51057 - py/trunk/py/doc Message-ID: <20080126113332.6DB0F168443@codespeak.net> Author: hpk Date: Sat Jan 26 12:33:32 2008 New Revision: 51057 Modified: py/trunk/py/doc/TODO.txt Log: review, refactor and write up for some 1.0 related TODOs Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Sat Jan 26 12:33:32 2008 @@ -1,11 +1,44 @@ Things to do for 1.0.0 ========================= +py.test +-------------- + +- review and refactor architecture of py.test with particular + respect to: + - writing (stacked) extensions / plugins (compared to Nose) + - event naming and processing + - porting existing extensions (htmlconftest / buildbot / + PyPy's conftest's ...) + - fast and stable distributed testing + - reliable cross-platform testing + +- fix reporting/usage degradation after reporter-merge merge: + - collapse skips with same reason and lineno into one line + +- fix and investigate win32 failures + +- (needs review) adjust py.test documentation to reflect new + collector/session architecture + +- document py.test's conftest.py approach + +py.execnet +-------------- +- cross-python version (2.2/2.3-2.5/6) and cross-platform testing of + setup/teardown semantics +- optimize general setup and rsync timing? +py.apigen +---------------- +- refactor to produce intermediate data/files capturing + info of test runs +- refactor html renderer to work on intermediate + data/files rather than on the live data ld (review and shift to above) @@ -14,9 +47,6 @@ refactorings ------------------ -- merge py.execnet-lessthreads branch (it's working relatively - nicely, already) (M995) - - session / collection unification (particularly tryiter and buildname2items) - reporting unification, i.e. use dist-testing Reporter class @@ -114,11 +144,6 @@ (guido tested all on win32, everything works except --dist (requires os.fork to work)) -distributed testing / RSession ------------------------------------- - -* (optional) see if more of py/test/session.py's Session can be reused - code quality ----------------- @@ -129,15 +154,9 @@ * review the pylib issue tracker (cfbolz: done: what has a 1.0.0 tag (or lower) should be looked at again) - py.test ------- -* (needs review) adjust py.test documentation to reflect new - collector/session architecture - -* (in-progress, NOT DONE) document py.test's conftest.py approach - * (postponed, likely) py.test fails to parse strangely formatted code after assertion failure Missing docstrings From hpk at codespeak.net Sat Jan 26 12:45:05 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 26 Jan 2008 12:45:05 +0100 (CET) Subject: [py-svn] r51058 - py/trunk/py/doc Message-ID: <20080126114505.44E2B168469@codespeak.net> Author: hpk Date: Sat Jan 26 12:45:03 2008 New Revision: 51058 Modified: py/trunk/py/doc/TODO.txt Log: fix ReST Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Sat Jan 26 12:45:03 2008 @@ -8,8 +8,7 @@ respect to: - writing (stacked) extensions / plugins (compared to Nose) - event naming and processing - - porting existing extensions (htmlconftest / buildbot / - PyPy's conftest's ...) + - porting existing extensions (htmlconftest / buildbot / PyPy's conftest's ...) - fast and stable distributed testing - reliable cross-platform testing From hpk at codespeak.net Sun Jan 27 12:55:29 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 27 Jan 2008 12:55:29 +0100 (CET) Subject: [py-svn] r51077 - py/trunk/py Message-ID: <20080127115529.005231684E7@codespeak.net> Author: hpk Date: Sun Jan 27 12:55:27 2008 New Revision: 51077 Modified: py/trunk/py/__init__.py Log: bump version number Modified: py/trunk/py/__init__.py ============================================================================== --- py/trunk/py/__init__.py (original) +++ py/trunk/py/__init__.py Sun Jan 27 12:55:27 2008 @@ -7,7 +7,7 @@ """ from initpkg import initpkg -version = "0.9.1-alpha" +version = "1.0-pre-alpha" initpkg(__name__, description = "pylib and py.test: agile development and test support library", From hpk at codespeak.net Sun Jan 27 22:33:31 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 27 Jan 2008 22:33:31 +0100 (CET) Subject: [py-svn] r51087 - py/trunk/py/test Message-ID: <20080127213331.0512716853A@codespeak.net> Author: hpk Date: Sun Jan 27 22:33:30 2008 New Revision: 51087 Modified: py/trunk/py/test/reporter.py Log: add a note that skip-reporting is broken after the branch-merge Modified: py/trunk/py/test/reporter.py ============================================================================== --- py/trunk/py/test/reporter.py (original) +++ py/trunk/py/test/reporter.py Sun Jan 27 22:33:30 2008 @@ -221,6 +221,9 @@ return host.hostid def skips(self): + # XXX review and test below, fix too many lines of + # skips that happen in the same file/lineno + # (this is correct in py-dist) texts = {} for event in self.skipped_tests_outcome: colitem = event.item From hpk at codespeak.net Wed Jan 30 12:22:20 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 12:22:20 +0100 (CET) Subject: [py-svn] r51121 - py/branch/event Message-ID: <20080130112220.2EE7A168447@codespeak.net> Author: hpk Date: Wed Jan 30 12:22:19 2008 New Revision: 51121 Added: py/branch/event/ - copied from r51120, py/trunk/ Log: branch for refactoring towards a generalized event architecture (for test events, particularly) From hpk at codespeak.net Wed Jan 30 12:58:19 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 12:58:19 +0100 (CET) Subject: [py-svn] r51122 - in py/branch/event/py/event: . testing Message-ID: <20080130115819.C7B0116844C@codespeak.net> Author: hpk Date: Wed Jan 30 12:58:16 2008 New Revision: 51122 Added: py/branch/event/py/event/ py/branch/event/py/event/testing/ Log: adding a general simple Event Hub (mirroring Jim's simple Zope3 zope.event mechanism) From hpk at codespeak.net Wed Jan 30 13:00:35 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 13:00:35 +0100 (CET) Subject: [py-svn] r51123 - in py/branch/event/py/event: . testing Message-ID: <20080130120035.B6162168410@codespeak.net> Author: hpk Date: Wed Jan 30 13:00:34 2008 New Revision: 51123 Added: py/branch/event/py/event/__init__.py (contents, props changed) py/branch/event/py/event/hub.py (contents, props changed) py/branch/event/py/event/testing/__init__.py (contents, props changed) py/branch/event/py/event/testing/test_hub.py (contents, props changed) Modified: py/branch/event/py/event/ (props changed) py/branch/event/py/event/testing/ (props changed) Log: actually adding the code for the event hub. Added: py/branch/event/py/event/__init__.py ============================================================================== --- (empty file) +++ py/branch/event/py/event/__init__.py Wed Jan 30 13:00:34 2008 @@ -0,0 +1 @@ +# Added: py/branch/event/py/event/hub.py ============================================================================== --- (empty file) +++ py/branch/event/py/event/hub.py Wed Jan 30 13:00:34 2008 @@ -0,0 +1,6 @@ + +class Hub(list): + """ General Event Hub """ + def notify(self, event): + for subscriber in self: + subscriber(event) Added: py/branch/event/py/event/testing/__init__.py ============================================================================== --- (empty file) +++ py/branch/event/py/event/testing/__init__.py Wed Jan 30 13:00:34 2008 @@ -0,0 +1 @@ +# Added: py/branch/event/py/event/testing/test_hub.py ============================================================================== --- (empty file) +++ py/branch/event/py/event/testing/test_hub.py Wed Jan 30 13:00:34 2008 @@ -0,0 +1,33 @@ +import py + +class TestHub: + + def test_simple(self): + hub = py.event.Hub() + l = [] + hub.append(l.append) + hub.notify(1) + hub.notify(2) + hub.notify(3) + assert l == [1,2,3] + + def test_multi_sub(self): + hub = py.event.Hub() + l1 = [] + l2 = [] + hub.append(l1.append) + hub.append(l2.append) + hub.notify(1) + hub.notify(2) + hub.notify(3) + assert l1 == [1,2,3] + assert l2 == [1,2,3] + + def test_remove(self): + hub = py.event.Hub() + l = [] + hub.append(l.append) + hub.notify(1) + hub.remove(l.append) + hub.notify(2) + assert l == [1] From hpk at codespeak.net Wed Jan 30 13:05:55 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 13:05:55 +0100 (CET) Subject: [py-svn] r51124 - in py/branch/event/py: . event event/testing Message-ID: <20080130120555.09F89168416@codespeak.net> Author: hpk Date: Wed Jan 30 13:05:54 2008 New Revision: 51124 Modified: py/branch/event/py/__init__.py py/branch/event/py/event/hub.py py/branch/event/py/event/testing/test_hub.py Log: adding a commented out global hub (not sure we need it) and enabling py.event namespace in py/__init__.py Modified: py/branch/event/py/__init__.py ============================================================================== --- py/branch/event/py/__init__.py (original) +++ py/branch/event/py/__init__.py Wed Jan 30 13:05:54 2008 @@ -51,6 +51,11 @@ 'test.collect.Item' : ('./test/item.py', 'Item'), 'test.collect.Function' : ('./test/item.py', 'Function'), + # Event related APIs + 'event.Hub' : ('./event/hub.py', 'Hub'), + #'event.hub' : ('./event/hub.py', 'hub'), + #'event.notify' : ('./event/hub.py', 'notify'), + # thread related API (still in early design phase) '_thread.WorkerPool' : ('./thread/pool.py', 'WorkerPool'), '_thread.NamedThreadPool' : ('./thread/pool.py', 'NamedThreadPool'), Modified: py/branch/event/py/event/hub.py ============================================================================== --- py/branch/event/py/event/hub.py (original) +++ py/branch/event/py/event/hub.py Wed Jan 30 13:05:54 2008 @@ -4,3 +4,8 @@ def notify(self, event): for subscriber in self: subscriber(event) + + +# XXX do we want a global hub? +#hub = Hub() +#notify = hub.notify Modified: py/branch/event/py/event/testing/test_hub.py ============================================================================== --- py/branch/event/py/event/testing/test_hub.py (original) +++ py/branch/event/py/event/testing/test_hub.py Wed Jan 30 13:05:54 2008 @@ -31,3 +31,4 @@ hub.remove(l.append) hub.notify(2) assert l == [1] + From hpk at codespeak.net Wed Jan 30 16:25:40 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 16:25:40 +0100 (CET) Subject: [py-svn] r51132 - py/trunk/py/doc Message-ID: <20080130152540.C6390168410@codespeak.net> Author: hpk Date: Wed Jan 30 16:25:40 2008 New Revision: 51132 Modified: py/trunk/py/doc/TODO.txt Log: a todo/note on skip's and speed (inspired by exarkun on #pypy) Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Wed Jan 30 16:25:40 2008 @@ -22,6 +22,10 @@ - document py.test's conftest.py approach +- review and optimize skip-handling (it can be quite slow in + certain situations because e.g. setup/teardown is fully performed + although we have "skip by keyword" and could detect this early) + py.execnet -------------- From hpk at codespeak.net Wed Jan 30 16:53:22 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 16:53:22 +0100 (CET) Subject: [py-svn] r51135 - in py/branch/event/py: . test test/testing Message-ID: <20080130155322.BED871683D0@codespeak.net> Author: hpk Date: Wed Jan 30 16:53:21 2008 New Revision: 51135 Modified: py/branch/event/py/__init__.py py/branch/event/py/test/item.py py/branch/event/py/test/testing/test_session.py Log: removing rather useless (IMO) py.test - 'notimplemented' and 'broken' logic Modified: py/branch/event/py/__init__.py ============================================================================== --- py/branch/event/py/__init__.py (original) +++ py/branch/event/py/__init__.py Wed Jan 30 16:53:21 2008 @@ -31,8 +31,6 @@ 'test.skip' : ('./test/item.py', 'skip'), 'test.fail' : ('./test/item.py', 'fail'), 'test.exit' : ('./test/session.py', 'exit'), - 'test.broken' : ('./test/item.py', 'Broken'), - 'test.notimplemented' : ('./test/item.py', '_NotImplemented'), 'test.pdb' : ('./test/custompdb.py', 'set_trace'), # configuration/initialization related test api Modified: py/branch/event/py/test/item.py ============================================================================== --- py/branch/event/py/test/item.py (original) +++ py/branch/event/py/test/item.py Wed Jan 30 16:53:21 2008 @@ -67,28 +67,9 @@ """ execute the given test function. """ target(*args) -# -# triggering specific outcomes while executing Items -# -class BaseReason(object): - def __init__(self, msg="unknown reason", **kwds): - self.msg = msg - self.__dict__.update(kwds) - - def __repr__(self): - return self.msg - -class Broken(BaseReason): - def __repr__(self): - return "Broken: %s" % (self.msg,) - -class _NotImplemented(BaseReason): - def __repr__(self): - return "Not implemented: %s" % (self.msg,) - # whatever comes here.... -def skip(msg=BaseReason()): +def skip(msg=""): """ skip with the given Message. """ __tracebackhide__ = True raise Skipped(msg=msg) Modified: py/branch/event/py/test/testing/test_session.py ============================================================================== --- py/branch/event/py/test/testing/test_session.py (original) +++ py/branch/event/py/test/testing/test_session.py Wed Jan 30 16:53:21 2008 @@ -277,23 +277,3 @@ out = l[1].excinfo.exconly() assert out.find("[unknown exception raised in repr()]") != -1 -def test_skip_reasons(): - tmp = py.test.ensuretemp("check_skip_reasons") - tmp.ensure("test_one.py").write(py.code.Source(""" - import py - def test_1(): - py.test.skip(py.test.broken('stuff')) - - def test_2(): - py.test.skip(py.test.notimplemented('stuff')) - """)) - tmp.ensure("__init__.py") - config = py.test.config._reparse([tmp]) - all = [] - session = config.initsession() - session.main(all.append) - skips = getskipped(all) - assert len(skips) == 2 - assert str(skips[0].skipped.value) == 'Broken: stuff' - assert str(skips[1].skipped.value) == 'Not implemented: stuff' - From hpk at codespeak.net Wed Jan 30 20:15:00 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 20:15:00 +0100 (CET) Subject: [py-svn] r51142 - in py/branch/event/py: bin test/rsession/testing test/testing Message-ID: <20080130191500.60EB3168422@codespeak.net> Author: hpk Date: Wed Jan 30 20:14:58 2008 New Revision: 51142 Added: py/branch/event/py/bin/_maketest2.py Modified: py/branch/event/py/test/rsession/testing/test_hostmanage.py py/branch/event/py/test/testing/test_reporter.py Log: * add a script that should help to test py.test refactorings with py.test * skip/fix some tests Added: py/branch/event/py/bin/_maketest2.py ============================================================================== --- (empty file) +++ py/branch/event/py/bin/_maketest2.py Wed Jan 30 20:14:58 2008 @@ -0,0 +1,62 @@ +""" create a py/test2 hierarchy for use of refactoring + but still be able to use py.test as a testing tool for + doing the refactorings. +""" + +from _findpy import py + +def change_init(initfile): + l = [] + for line in initfile.readlines(): + newline = line + l.append(line) + newline = newline.replace("'test.", "'test2.") + newline = newline.replace("'./test/", "'./test2/") + if newline != line: + l.append(newline) + initfile.write("".join(l)) + +def perform_replace(directory): + for x in directory.visit("*.py", + rec=lambda x: x.check(dir=1, dotfile=0)): + if x.basename == "__init__.py": + continue + s = n = x.read() + n = n.replace("py.test.", "py.test2.") + #n = n.replace("py.test2.skip", "py.test.skip") + n = n.replace("py.test ", "py.test2 ") + n = n.replace("py.__.test.", "py.__.test2.") + n = n.replace("py.__.test ", "py.__.test2 ") + if x.basename.startswith("test_"): + n = n.replace("py.test2.skip(", "py.test.skip(") + + if s != n: + if n.find("TestCaseUnit") != -1: + n = n.replace("py.test2.collect", "py.test.collect") + print "writing modified", x + x.write(n) + +def cmd(command): + print "* executing:", command + return py.process.cmdexec(command) + +if __name__ == '__main__': + basedir = py.path.local(py.__file__).dirpath() + #st = py.path.svnwc(basedir).status() + #assert not st.modified + olddir = basedir.chdir() + try: + initfile = basedir.join("__init__.py") + cmd("svn revert %s" % initfile) + change_init(initfile) + + test2dir = basedir.join("test2") + cmd("svn revert -R test2") + cmd("rm -rf test2") + cmd("svn cp test test2") + perform_replace(test2dir) + + finally: + olddir.chdir() + + Modified: py/branch/event/py/test/rsession/testing/test_hostmanage.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_hostmanage.py (original) +++ py/branch/event/py/test/rsession/testing/test_hostmanage.py Wed Jan 30 20:14:58 2008 @@ -86,7 +86,7 @@ def test_initgateway_ssh_and_remotepath(self): option = py.test.config.option - if option.sshtarget is None: + if getattr(option, 'sshtarget', None) is None: py.test.skip("no known ssh target, use -S to set one") host = HostInfo("%s" % (option.sshtarget, )) # this test should be careful to not write/rsync anything Modified: py/branch/event/py/test/testing/test_reporter.py ============================================================================== --- py/branch/event/py/test/testing/test_reporter.py (original) +++ py/branch/event/py/test/testing/test_reporter.py Wed Jan 30 20:14:58 2008 @@ -227,6 +227,7 @@ assert output.endswith("FsF."), output def test_full_module(self): + py.test.skip("fix exact output matching test") received = self._test_full_module() expected_lst = ["repmod/test_one.py", "FAILED TO LOAD MODULE", "skipped", "reason"] @@ -261,6 +262,7 @@ assert val.find(expected) != -1 def test_full_module(self): + py.test.skip("fix exact output matching test") val = self._test_full_module() assert val.find("FAILED TO LOAD MODULE: repmod/test_three.py\n"\ "\nSkipped ('reason') repmod/test_two.py") != -1 From hpk at codespeak.net Wed Jan 30 20:26:52 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 20:26:52 +0100 (CET) Subject: [py-svn] r51143 - py/branch/event/py/test/rsession Message-ID: <20080130192652.8495E168424@codespeak.net> Author: hpk Date: Wed Jan 30 20:26:51 2008 New Revision: 51143 Modified: py/branch/event/py/test/rsession/master.py Log: avoid relying on global config state here Modified: py/branch/event/py/test/rsession/master.py ============================================================================== --- py/branch/event/py/test/rsession/master.py (original) +++ py/branch/event/py/test/rsession/master.py Wed Jan 30 20:26:51 2008 @@ -43,9 +43,7 @@ def dispatch_loop(masternodes, itemgenerator, shouldstop, waiter = lambda: py.std.time.sleep(0.1), - max_tasks_per_node=None): - if not max_tasks_per_node: - max_tasks_per_node = py.test.config.getvalue("dist_taskspernode") + max_tasks_per_node=15): all_tests = {} while 1: try: From hpk at codespeak.net Wed Jan 30 20:30:17 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 20:30:17 +0100 (CET) Subject: [py-svn] r51144 - py/branch/event/py/test/rsession Message-ID: <20080130193017.4F832168411@codespeak.net> Author: hpk Date: Wed Jan 30 20:30:16 2008 New Revision: 51144 Modified: py/branch/event/py/test/rsession/rsession.py Log: load dist_taskspernode config value here (see rev 51143 commit) Modified: py/branch/event/py/test/rsession/rsession.py ============================================================================== --- py/branch/event/py/test/rsession/rsession.py (original) +++ py/branch/event/py/test/rsession/rsession.py Wed Jan 30 20:30:16 2008 @@ -84,4 +84,6 @@ colitems = self.config.getcolitems() keyword = self.config.option.keyword itemgenerator = itemgen(self, colitems, reporter, keyword) - all_tests = dispatch_loop(nodes, itemgenerator, checkfun) + max_tasks_per_node = self.config.getvalue("dist_taskspernode") + all_tests = dispatch_loop(nodes, itemgenerator, checkfun, + max_tasks_per_node=max_tasks_per_node) From hpk at codespeak.net Wed Jan 30 20:38:16 2008 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 30 Jan 2008 20:38:16 +0100 (CET) Subject: [py-svn] r51145 - in py/branch/event/py: . test2 test2/rsession test2/rsession/testing test2/terminal test2/testing test2/web Message-ID: <20080130193816.C4864168416@codespeak.net> Author: hpk Date: Wed Jan 30 20:38:14 2008 New Revision: 51145 Added: py/branch/event/py/test2/ - copied from r51144, py/branch/event/py/test/ Modified: py/branch/event/py/__init__.py py/branch/event/py/test2/box.py py/branch/event/py/test2/cmdline.py py/branch/event/py/test2/collect.py py/branch/event/py/test2/collectonly.py py/branch/event/py/test2/compat.py py/branch/event/py/test2/config.py py/branch/event/py/test2/conftesthandle.py py/branch/event/py/test2/defaultconftest.py py/branch/event/py/test2/doctest.py py/branch/event/py/test2/executor.py py/branch/event/py/test2/item.py py/branch/event/py/test2/raises.py py/branch/event/py/test2/repevent.py py/branch/event/py/test2/reporter.py py/branch/event/py/test2/representation.py py/branch/event/py/test2/rsession/hostmanage.py py/branch/event/py/test2/rsession/local.py py/branch/event/py/test2/rsession/master.py py/branch/event/py/test2/rsession/rest.py py/branch/event/py/test2/rsession/rsession.py py/branch/event/py/test2/rsession/slave.py py/branch/event/py/test2/rsession/testing/basetest.py py/branch/event/py/test2/rsession/testing/test_hostmanage.py py/branch/event/py/test2/rsession/testing/test_master.py py/branch/event/py/test2/rsession/testing/test_rest.py py/branch/event/py/test2/rsession/testing/test_rsession.py py/branch/event/py/test2/rsession/testing/test_slave.py py/branch/event/py/test2/rsession/testing/test_web.py py/branch/event/py/test2/rsession/testing/test_webjs.py py/branch/event/py/test2/rsession/web.py py/branch/event/py/test2/rsession/webjs.py py/branch/event/py/test2/session.py py/branch/event/py/test2/terminal/remote.py py/branch/event/py/test2/testing/setupdata.py py/branch/event/py/test2/testing/test_boxing.py py/branch/event/py/test2/testing/test_collect.py py/branch/event/py/test2/testing/test_collectonly.py py/branch/event/py/test2/testing/test_compat.py py/branch/event/py/test2/testing/test_config.py py/branch/event/py/test2/testing/test_conftesthandle.py py/branch/event/py/test2/testing/test_deprecated.py py/branch/event/py/test2/testing/test_doctest.py py/branch/event/py/test2/testing/test_executor.py py/branch/event/py/test2/testing/test_itemgen.py py/branch/event/py/test2/testing/test_outcome.py py/branch/event/py/test2/testing/test_remote.py py/branch/event/py/test2/testing/test_repevent.py py/branch/event/py/test2/testing/test_reporter.py py/branch/event/py/test2/testing/test_repr.py py/branch/event/py/test2/testing/test_session.py py/branch/event/py/test2/testing/test_session2.py py/branch/event/py/test2/web/webcheck.py Log: make a py.test2 namespace for incremental refactoring and to allow to use py.test itself for testing it. Modified: py/branch/event/py/__init__.py ============================================================================== --- py/branch/event/py/__init__.py (original) +++ py/branch/event/py/__init__.py Wed Jan 30 20:38:14 2008 @@ -26,28 +26,47 @@ exportdefs = { # helpers for use from test functions or collectors 'test.__doc__' : ('./test/__init__.py', '__doc__'), + 'test2.__doc__' : ('./test2/__init__.py', '__doc__'), 'test.raises' : ('./test/raises.py', 'raises'), + 'test2.raises' : ('./test2/raises.py', 'raises'), 'test.deprecated_call' : ('./test/deprecate.py', 'deprecated_call'), + 'test2.deprecated_call' : ('./test2/deprecate.py', 'deprecated_call'), 'test.skip' : ('./test/item.py', 'skip'), + 'test2.skip' : ('./test2/item.py', 'skip'), 'test.fail' : ('./test/item.py', 'fail'), + 'test2.fail' : ('./test2/item.py', 'fail'), 'test.exit' : ('./test/session.py', 'exit'), + 'test2.exit' : ('./test2/session.py', 'exit'), 'test.pdb' : ('./test/custompdb.py', 'set_trace'), + 'test2.pdb' : ('./test2/custompdb.py', 'set_trace'), # configuration/initialization related test api 'test.config' : ('./test/config.py', 'config_per_process'), + 'test2.config' : ('./test2/config.py', 'config_per_process'), 'test.ensuretemp' : ('./test/config.py', 'ensuretemp'), + 'test2.ensuretemp' : ('./test2/config.py', 'ensuretemp'), 'test.cmdline.main' : ('./test/cmdline.py', 'main'), + 'test2.cmdline.main' : ('./test2/cmdline.py', 'main'), # for customization of collecting/running tests 'test.collect.Collector' : ('./test/collect.py', 'Collector'), + 'test2.collect.Collector' : ('./test2/collect.py', 'Collector'), 'test.collect.Directory' : ('./test/collect.py', 'Directory'), + 'test2.collect.Directory' : ('./test2/collect.py', 'Directory'), 'test.collect.Module' : ('./test/collect.py', 'Module'), + 'test2.collect.Module' : ('./test2/collect.py', 'Module'), 'test.collect.DoctestFile' : ('./test/collect.py', 'DoctestFile'), + 'test2.collect.DoctestFile' : ('./test2/collect.py', 'DoctestFile'), 'test.collect.Class' : ('./test/collect.py', 'Class'), + 'test2.collect.Class' : ('./test2/collect.py', 'Class'), 'test.collect.Instance' : ('./test/collect.py', 'Instance'), + 'test2.collect.Instance' : ('./test2/collect.py', 'Instance'), 'test.collect.Generator' : ('./test/collect.py', 'Generator'), + 'test2.collect.Generator' : ('./test2/collect.py', 'Generator'), 'test.collect.Item' : ('./test/item.py', 'Item'), + 'test2.collect.Item' : ('./test2/item.py', 'Item'), 'test.collect.Function' : ('./test/item.py', 'Function'), + 'test2.collect.Function' : ('./test2/item.py', 'Function'), # Event related APIs 'event.Hub' : ('./event/hub.py', 'Hub'), Modified: py/branch/event/py/test2/box.py ============================================================================== --- py/branch/event/py/test/box.py (original) +++ py/branch/event/py/test2/box.py Wed Jan 30 20:38:14 2008 @@ -7,7 +7,7 @@ import os import sys import marshal -from py.__.test import config as pytestconfig +from py.__.test2 import config as pytestconfig PYTESTSTDOUT = "pyteststdout" PYTESTSTDERR = "pyteststderr" @@ -32,9 +32,9 @@ self.kwargs = kwargs def run(self, continuation=False): - # XXX we should not use py.test.ensuretemp here + # XXX we should not use py.test2.ensuretemp here count = counter() - tempdir = py.test.ensuretemp("box%d" % count) + tempdir = py.test2.ensuretemp("box%d" % count) self.tempdir = tempdir self.PYTESTRETVAL = tempdir.join('retval') self.PYTESTSTDOUT = tempdir.join('stdout') Modified: py/branch/event/py/test2/cmdline.py ============================================================================== --- py/branch/event/py/test/cmdline.py (original) +++ py/branch/event/py/test2/cmdline.py Wed Jan 30 20:38:14 2008 @@ -8,7 +8,7 @@ warn_about_missing_assertion() if args is None: args = py.std.sys.argv[1:] - config = py.test.config + config = py.test2.config config.parse(args) session = config.initsession() try: Modified: py/branch/event/py/test2/collect.py ============================================================================== --- py/branch/event/py/test/collect.py (original) +++ py/branch/event/py/test2/collect.py Wed Jan 30 20:38:14 2008 @@ -25,7 +25,7 @@ """ from __future__ import generators import py -from py.__.test.outcome import Skipped +from py.__.test2.outcome import Skipped def configproperty(name): def fget(self): @@ -45,7 +45,7 @@ def __init__(self, name, parent=None): self.name = name self.parent = parent - self._config = getattr(parent, '_config', py.test.config) + self._config = getattr(parent, '_config', py.test2.config) self.fspath = getattr(parent, 'fspath', None) Module = configproperty('Module') @@ -181,7 +181,7 @@ if eor: key = key[1:] if not (eor ^ self._matchonekeyword(key, chain)): - py.test.skip("test not selected by keyword %r" %(keyword,)) + py.test2.skip("test not selected by keyword %r" %(keyword,)) def _matchonekeyword(self, key, chain): elems = key.split(".") @@ -208,11 +208,11 @@ cases. """ if yieldtype is None: - yieldtype = py.test.collect.Item + yieldtype = py.test2.collect.Item if isinstance(self, yieldtype): yield self else: - if not isinstance(self, py.test.collect.Item): + if not isinstance(self, py.test2.collect.Item): try: for x in self.run(): for y in self.join(x)._tryiter(yieldtype): @@ -283,7 +283,7 @@ elif p.ext == '.txt': res = self.DoctestFile(p, parent=self) elif p.check(dir=1): - Directory = py.test.config.getvalue('Directory', p) + Directory = py.test2.config.getvalue('Directory', p) res = Directory(p, parent=self) name2items[name] = res return res @@ -430,7 +430,7 @@ except IOError: pass # fall back... - for x in self._tryiter((py.test.collect.Generator, py.test.collect.Item)): + for x in self._tryiter((py.test2.collect.Generator, py.test2.collect.Item)): return x._getsortvalue() class Instance(PyCollectorMixin, Collector): @@ -507,7 +507,7 @@ return [self.fspath.basename] def join(self, name): - from py.__.test.doctest import DoctestText + from py.__.test2.doctest import DoctestText if name == self.fspath.basename: item = DoctestText(self.fspath.basename, parent=self) item._content = self.fspath.read() Modified: py/branch/event/py/test2/collectonly.py ============================================================================== --- py/branch/event/py/test/collectonly.py (original) +++ py/branch/event/py/test2/collectonly.py Wed Jan 30 20:38:14 2008 @@ -3,8 +3,8 @@ """ import py -from py.__.test.session import Session -from py.__.test.reporter import LocalReporter +from py.__.test2.session import Session +from py.__.test2.reporter import LocalReporter class CollectReporter(LocalReporter): def __init__(self, *args, **kwds): Modified: py/branch/event/py/test2/compat.py ============================================================================== --- py/branch/event/py/test/compat.py (original) +++ py/branch/event/py/test2/compat.py Wed Jan 30 20:38:14 2008 @@ -1,5 +1,5 @@ import py -from py.__.test.outcome import Failed, Passed +from py.__.test2.outcome import Failed, Passed class TestCaseUnit(py.test.collect.Function): @@ -31,7 +31,7 @@ raise Failed(msg=msg) def assertRaises(self, excclass, func, *args, **kwargs): - py.test.raises(excclass, func, *args, **kwargs) + py.test2.raises(excclass, func, *args, **kwargs) failUnlessRaises = assertRaises # dynamically construct (redundant) methods Modified: py/branch/event/py/test2/config.py ============================================================================== --- py/branch/event/py/test/config.py (original) +++ py/branch/event/py/test2/config.py Wed Jan 30 20:38:14 2008 @@ -2,7 +2,7 @@ import py from conftesthandle import Conftest -from py.__.test.defaultconftest import adddefaultoptions +from py.__.test2.defaultconftest import adddefaultoptions optparse = py.compat.optparse @@ -173,13 +173,13 @@ """ this is used from tests that want to re-invoke parse(). """ #assert args # XXX should not be empty global config_per_process - oldconfig = py.test.config + oldconfig = py.test2.config try: - config_per_process = py.test.config = Config() + config_per_process = py.test2.config = Config() config_per_process.parse(args) return config_per_process finally: - config_per_process = py.test.config = oldconfig + config_per_process = py.test2.config = oldconfig def _makerepr(self, conftestnames, optnames=None): """ return a marshallable representation @@ -260,16 +260,16 @@ del colitem._capture colitem._captured_out, colitem._captured_err = capture.reset() -# this is the one per-process instance of py.test configuration +# this is the one per-process instance of py.test2 configuration config_per_process = Config() # default import paths for sessions -Session = 'py.__.test.session' -RemoteTerminalSession = 'py.__.test.terminal.remote' -RSession = 'py.__.test.rsession.rsession' -LSession = 'py.__.test.rsession.rsession' -CollectSession = 'py.__.test.collectonly' +Session = 'py.__.test2.session' +RemoteTerminalSession = 'py.__.test2.terminal.remote' +RSession = 'py.__.test2.rsession.rsession' +LSession = 'py.__.test2.rsession.rsession' +CollectSession = 'py.__.test2.collectonly' # # helpers Modified: py/branch/event/py/test2/conftesthandle.py ============================================================================== --- py/branch/event/py/test/conftesthandle.py (original) +++ py/branch/event/py/test2/conftesthandle.py Wed Jan 30 20:38:14 2008 @@ -3,7 +3,7 @@ class Conftest(object): """ the single place for accessing values and interacting - towards conftest modules from py.test objects. + towards conftest modules from py.test2 objects. Note that triggering Conftest instances to import conftest.py files may result in added cmdline options. Modified: py/branch/event/py/test2/defaultconftest.py ============================================================================== --- py/branch/event/py/test/defaultconftest.py (original) +++ py/branch/event/py/test2/defaultconftest.py Wed Jan 30 20:38:14 2008 @@ -1,12 +1,12 @@ import py -Module = py.test.collect.Module -DoctestFile = py.test.collect.DoctestFile -Directory = py.test.collect.Directory -Class = py.test.collect.Class -Generator = py.test.collect.Generator -Function = py.test.collect.Function -Instance = py.test.collect.Instance +Module = py.test2.collect.Module +DoctestFile = py.test2.collect.DoctestFile +Directory = py.test2.collect.Directory +Class = py.test2.collect.Class +Generator = py.test2.collect.Generator +Function = py.test2.collect.Function +Instance = py.test2.collect.Instance conf_iocapture = "fd" # overridable from conftest.py @@ -20,7 +20,7 @@ dist_taskspernode = 15 dist_boxed = False if hasattr(py.std.os, 'nice'): - dist_nicelevel = py.std.os.nice(0) # nice py.test works + dist_nicelevel = py.std.os.nice(0) # nice py.test2 works else: dist_nicelevel = 0 dist_rsync_ignore = [] Modified: py/branch/event/py/test2/doctest.py ============================================================================== --- py/branch/event/py/test/doctest.py (original) +++ py/branch/event/py/test2/doctest.py Wed Jan 30 20:38:14 2008 @@ -1,6 +1,6 @@ import py -class DoctestText(py.test.collect.Item): +class DoctestText(py.test2.collect.Item): def _setcontent(self, content): self._content = content @@ -29,5 +29,5 @@ mod.__doc__ = docstring failed, tot = py.compat.doctest.testmod(mod, verbose=1) if failed: - py.test.fail("doctest %s: %s failed out of %s" %( + py.test2.fail("doctest %s: %s failed out of %s" %( self.fspath, failed, tot)) Modified: py/branch/event/py/test2/executor.py ============================================================================== --- py/branch/event/py/test/executor.py (original) +++ py/branch/event/py/test2/executor.py Wed Jan 30 20:38:14 2008 @@ -3,11 +3,11 @@ import py, os, sys -from py.__.test.outcome import SerializableOutcome, ReprOutcome -from py.__.test.box import Box -from py.__.test import repevent -from py.__.test.outcome import Skipped, Failed -import py.__.test.custompdb +from py.__.test2.outcome import SerializableOutcome, ReprOutcome +from py.__.test2.box import Box +from py.__.test2 import repevent +from py.__.test2.outcome import Skipped, Failed +import py.__.test2.custompdb class RunExecutor(object): """ Same as in executor, but just running run @@ -48,7 +48,7 @@ excinfo = e.excinfo else: excinfo = py.code.ExceptionInfo() - if isinstance(self.item, py.test.collect.Function): + if isinstance(self.item, py.test2.collect.Function): fun = self.item.obj # hope this is stable code = py.code.Code(fun) excinfo.traceback = excinfo.traceback.cut( @@ -60,7 +60,7 @@ self.reporter(repevent.ImmediateFailure(self.item, ReprOutcome(outcome.make_repr (self.config.option.tbstyle)))) - py.__.test.custompdb.post_mortem(excinfo._excinfo[2]) + py.__.test2.custompdb.post_mortem(excinfo._excinfo[2]) # XXX hmm, we probably will not like to continue from that # point raise SystemExit() @@ -85,7 +85,7 @@ """ We want to trace *only* function objects here. Unsure what to do with custom collectors at all """ - if hasattr(self.item, 'obj') and type(self.item) is py.test.collect.Function: + if hasattr(self.item, 'obj') and type(self.item) is py.test2.collect.Function: self.item.execute = self.wrap_underlaying self.item.run() Modified: py/branch/event/py/test2/item.py ============================================================================== --- py/branch/event/py/test/item.py (original) +++ py/branch/event/py/test2/item.py Wed Jan 30 20:38:14 2008 @@ -1,8 +1,8 @@ import py from inspect import isclass, ismodule -from py.__.test.outcome import Skipped, Failed, Passed -from py.__.test.collect import FunctionMixin +from py.__.test2.outcome import Skipped, Failed, Passed +from py.__.test2.collect import FunctionMixin _dummy = object() @@ -31,7 +31,7 @@ col.setup() self.stack.append(col) -class Item(py.test.collect.Collector): +class Item(py.test2.collect.Collector): def startcapture(self): self._config._startcapture(self, path=self.fspath) Modified: py/branch/event/py/test2/raises.py ============================================================================== --- py/branch/event/py/test/raises.py (original) +++ py/branch/event/py/test2/raises.py Wed Jan 30 20:38:14 2008 @@ -1,6 +1,6 @@ import sys import py -from py.__.test.outcome import ExceptionFailure +from py.__.test2.outcome import ExceptionFailure def raises(ExpectedException, *args, **kwargs): """ raise AssertionError, if target code does not raise the expected Modified: py/branch/event/py/test2/repevent.py ============================================================================== --- py/branch/event/py/test/repevent.py (original) +++ py/branch/event/py/test2/repevent.py Wed Jan 30 20:38:14 2008 @@ -11,7 +11,7 @@ # pass ##def report_error(excinfo): -## if isinstance(excinfo, py.test.collect.Item.Skipped): +## if isinstance(excinfo, py.test2.collect.Item.Skipped): ## # we need to dispatch this info ## report(Skipped(excinfo)) ## else: Modified: py/branch/event/py/test2/reporter.py ============================================================================== --- py/branch/event/py/test/reporter.py (original) +++ py/branch/event/py/test2/reporter.py Wed Jan 30 20:38:14 2008 @@ -7,11 +7,11 @@ import py -from py.__.test.terminal.out import getout -from py.__.test import repevent -from py.__.test import outcome +from py.__.test2.terminal.out import getout +from py.__.test2 import repevent +from py.__.test2 import outcome from py.__.misc.terminal_helper import ansi_print, get_terminal_width -from py.__.test.representation import Presenter, repr_pythonversion,\ +from py.__.test2.representation import Presenter, repr_pythonversion,\ getrelpath import sys @@ -21,10 +21,10 @@ def choose_reporter(reporterclass, config): option = config.option if option.startserver or option.runbrowser: - from py.__.test.rsession.web import WebReporter + from py.__.test2.rsession.web import WebReporter return WebReporter if option.restreport: - from py.__.test.rsession.rest import RestReporter + from py.__.test2.rsession.rest import RestReporter return RestReporter else: return reporterclass @@ -378,7 +378,7 @@ def report_SkippedTryiter(self, event): #self.show_item(event.item, False) - if isinstance(event.item, py.test.collect.Module): + if isinstance(event.item, py.test2.collect.Module): self.out.write("- skipped (%s)" % event.excinfo.value) else: self.out.write("s") @@ -409,10 +409,10 @@ self.show_item(event.item) def show_item(self, item, count_elems = True): - if isinstance(item, py.test.collect.Module): + if isinstance(item, py.test2.collect.Module): self.show_Module(item) if self.config.option.verbose > 0 and\ - isinstance(item, py.test.collect.Item): + isinstance(item, py.test2.collect.Item): self.show_ItemVerbose(item) def show_ItemVerbose(self, item): Modified: py/branch/event/py/test2/representation.py ============================================================================== --- py/branch/event/py/test/representation.py (original) +++ py/branch/event/py/test2/representation.py Wed Jan 30 20:38:14 2008 @@ -51,14 +51,14 @@ self.out.line(prefix + source[i]) def repr_item_info(self, item): - """ This method represents py.test.collect.Item info (path and module) + """ This method represents py.test2.collect.Item info (path and module) """ root = item.fspath modpath = item._getmodpath() try: fn, lineno = item._getpathlineno() except TypeError: - assert isinstance(item.parent, py.test.collect.Generator) + assert isinstance(item.parent, py.test2.collect.Generator) # a generative test yielded a non-callable fn, lineno = item.parent._getpathlineno() if root == fn: Modified: py/branch/event/py/test2/rsession/hostmanage.py ============================================================================== --- py/branch/event/py/test/rsession/hostmanage.py (original) +++ py/branch/event/py/test2/rsession/hostmanage.py Wed Jan 30 20:38:14 2008 @@ -2,10 +2,10 @@ import py import time import thread, threading -from py.__.test.rsession.master import MasterNode -from py.__.test.rsession.slave import setup_slave +from py.__.test2.rsession.master import MasterNode +from py.__.test2.rsession.slave import setup_slave -from py.__.test import repevent +from py.__.test2 import repevent class HostInfo(object): """ Class trying to store all necessary attributes Modified: py/branch/event/py/test2/rsession/local.py ============================================================================== --- py/branch/event/py/test/rsession/local.py (original) +++ py/branch/event/py/test2/rsession/local.py Wed Jan 30 20:38:14 2008 @@ -3,10 +3,10 @@ """ import py -from py.__.test.executor import BoxExecutor, RunExecutor,\ +from py.__.test2.executor import BoxExecutor, RunExecutor,\ ApigenExecutor -from py.__.test import repevent -from py.__.test.outcome import ReprOutcome +from py.__.test2 import repevent +from py.__.test2.outcome import ReprOutcome # XXX copied from session.py def startcapture(session): Modified: py/branch/event/py/test2/rsession/master.py ============================================================================== --- py/branch/event/py/test/rsession/master.py (original) +++ py/branch/event/py/test2/rsession/master.py Wed Jan 30 20:38:14 2008 @@ -2,9 +2,9 @@ Node code for Master. """ import py -from py.__.test.outcome import ReprOutcome -from py.__.test import repevent -from py.__.test.outcome import Skipped +from py.__.test2.outcome import ReprOutcome +from py.__.test2 import repevent +from py.__.test2.outcome import Skipped from py.builtin import GeneratorExit class MasterNode(object): Modified: py/branch/event/py/test2/rsession/rest.py ============================================================================== --- py/branch/event/py/test/rsession/rest.py (original) +++ py/branch/event/py/test2/rsession/rest.py Wed Jan 30 20:38:14 2008 @@ -5,8 +5,8 @@ import py import sys from StringIO import StringIO -from py.__.test.reporter import AbstractReporter -from py.__.test import repevent +from py.__.test2.reporter import AbstractReporter +from py.__.test2 import repevent from py.__.rest.rst import * class RestReporter(AbstractReporter): @@ -71,7 +71,7 @@ def report_ItemStart(self, event): item = event.item - if isinstance(item, py.test.collect.Module): + if isinstance(item, py.test2.collect.Module): lgt = len(list(item._tryiter())) lns = item.listnames()[1:] name = "/".join(lns) Modified: py/branch/event/py/test2/rsession/rsession.py ============================================================================== --- py/branch/event/py/test/rsession/rsession.py (original) +++ py/branch/event/py/test2/rsession/rsession.py Wed Jan 30 20:38:14 2008 @@ -8,14 +8,14 @@ import re import time -from py.__.test import repevent -from py.__.test.rsession.master import MasterNode, dispatch_loop -from py.__.test.rsession.hostmanage import HostInfo, HostManager -from py.__.test.rsession.local import local_loop, plain_runner, apigen_runner,\ +from py.__.test2 import repevent +from py.__.test2.rsession.master import MasterNode, dispatch_loop +from py.__.test2.rsession.hostmanage import HostInfo, HostManager +from py.__.test2.rsession.local import local_loop, plain_runner, apigen_runner,\ box_runner -from py.__.test.reporter import LocalReporter, RemoteReporter, TestReporter -from py.__.test.session import AbstractSession, itemgen -from py.__.test.outcome import Skipped, Failed +from py.__.test2.reporter import LocalReporter, RemoteReporter, TestReporter +from py.__.test2.session import AbstractSession, itemgen +from py.__.test2.outcome import Skipped, Failed class RSession(AbstractSession): """ Remote version of session Modified: py/branch/event/py/test2/rsession/slave.py ============================================================================== --- py/branch/event/py/test/rsession/slave.py (original) +++ py/branch/event/py/test2/rsession/slave.py Wed Jan 30 20:38:14 2008 @@ -3,9 +3,9 @@ """ import py -from py.__.test.executor import RunExecutor, BoxExecutor, AsyncExecutor -from py.__.test.outcome import SerializableOutcome -from py.__.test.outcome import Skipped +from py.__.test2.executor import RunExecutor, BoxExecutor, AsyncExecutor +from py.__.test2.outcome import SerializableOutcome +from py.__.test2.outcome import Skipped import thread import os @@ -38,7 +38,7 @@ node = nodes.get(item[0], None) if node is not None: return node - col = py.test.collect.Directory(str(py.path.local(path).join(item[0]))) + col = py.test2.collect.Directory(str(py.path.local(path).join(item[0]))) if config.option.boxed: executor = BoxExecutor else: @@ -88,7 +88,7 @@ # setup defaults... sys.path.insert(0, basedir) import py - config = py.test.config + config = py.test2.config assert not config._initialized config._initdirect(basedir, config_repr) if hasattr(os, 'nice'): @@ -96,7 +96,7 @@ os.nice(nice_level) if not config.option.nomagic: py.magic.invoke(assertion=1) - from py.__.test.rsession.slave import slave_main + from py.__.test2.rsession.slave import slave_main slave_main(channel.receive, channel.send, basedir, config) if not config.option.nomagic: py.magic.revoke(assertion=1) Modified: py/branch/event/py/test2/rsession/testing/basetest.py ============================================================================== --- py/branch/event/py/test/rsession/testing/basetest.py (original) +++ py/branch/event/py/test2/rsession/testing/basetest.py Wed Jan 30 20:38:14 2008 @@ -14,7 +14,7 @@ raise AssertionError("hello world") def funcskip(): - py.test.skip("skipped") + py.test2.skip("skipped") def funcprint(): print "samfing" @@ -24,7 +24,7 @@ asddsa def funcoptioncustom(): - assert py.test.config.getvalue("custom") + assert py.test2.config.getvalue("custom") def funchang(): import time @@ -32,11 +32,11 @@ class BasicRsessionTest(object): def setup_class(cls): - tmpdir = py.test.ensuretemp(cls.__name__) + tmpdir = py.test2.ensuretemp(cls.__name__) source = py.code.Source(func_source)[1:].deindent() testonepath = tmpdir.ensure("test_one.py") testonepath.write(source) - cls.config = py.test.config._reparse([tmpdir]) + cls.config = py.test2.config._reparse([tmpdir]) cls.collector_test_one = cls.config._getcollector(testonepath) cls.doctest = tmpdir.ensure("xxx.txt").write(py.code.Source(""" Aha!!!!!! Modified: py/branch/event/py/test2/rsession/testing/test_hostmanage.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_hostmanage.py (original) +++ py/branch/event/py/test2/rsession/testing/test_hostmanage.py Wed Jan 30 20:38:14 2008 @@ -3,14 +3,14 @@ """ import py -from py.__.test.rsession.hostmanage import HostRSync, HostInfo, HostManager -from py.__.test.rsession.hostmanage import sethomedir, gethomedir, getpath_relto_home -from py.__.test import repevent +from py.__.test2.rsession.hostmanage import HostRSync, HostInfo, HostManager +from py.__.test2.rsession.hostmanage import sethomedir, gethomedir, getpath_relto_home +from py.__.test2 import repevent class DirSetup: def setup_method(self, method): name = "%s.%s" %(self.__class__.__name__, method.func_name) - self.tmpdir = py.test.ensuretemp(name) + self.tmpdir = py.test2.ensuretemp(name) self.source = self.tmpdir.ensure("source", dir=1) self.dest = self.tmpdir.join("dest") @@ -53,7 +53,7 @@ def test_non_existing_hosts(self): host = HostInfo("alskdjalsdkjasldkajlsd") - py.test.raises((py.process.cmdexec.Error, IOError, EOFError), + py.test2.raises((py.process.cmdexec.Error, IOError, EOFError), host.initgateway) def test_remote_has_homedir_as_currentdir(self): @@ -85,7 +85,7 @@ host.gw.exit() def test_initgateway_ssh_and_remotepath(self): - option = py.test.config.option + option = py.test2.config.option if getattr(option, 'sshtarget', None) is None: py.test.skip("no known ssh target, use -S to set one") host = HostInfo("%s" % (option.sshtarget, )) @@ -174,14 +174,14 @@ if dist_rsync_roots: l.append("dist_rsync_roots = %r" % dist_rsync_roots) self.source.join("conftest.py").write("\n".join(l)) - config = py.test.config._reparse([self.source]) + config = py.test2.config._reparse([self.source]) assert config.topdir == self.source hm = HostManager(config) assert hm.hosts return hm def test_hostmanager_custom_hosts(self): - config = py.test.config._reparse([self.source]) + config = py.test2.config._reparse([self.source]) hm = HostManager(config, hosts=[1,2,3]) assert hm.hosts == [1,2,3] @@ -220,7 +220,7 @@ self.source.join("conftest.py").write(py.code.Source(""" dist_rsync_roots = ['dir1/dir2'] """)) - config = py.test.config._reparse([self.source]) + config = py.test2.config._reparse([self.source]) hm = HostManager(config, hosts=[HostInfo("localhost:" + str(self.dest))]) events = [] @@ -237,7 +237,7 @@ self.source.join("conftest.py").write(py.code.Source(""" dist_rsync_ignore = ['dir1/dir2', 'dir5/dir6'] """)) - config = py.test.config._reparse([self.source]) + config = py.test2.config._reparse([self.source]) hm = HostManager(config, hosts=[HostInfo("localhost:" + str(self.dest))]) events = [] @@ -250,7 +250,7 @@ def test_hostmanage_optimise_localhost(self): hosts = [HostInfo("localhost") for i in range(3)] - config = py.test.config._reparse([self.source]) + config = py.test2.config._reparse([self.source]) hm = HostManager(config, hosts=hosts) events = [] hm.init_rsync(events.append) @@ -262,7 +262,7 @@ def XXXtest_ssh_rsync_samehost_twice(self): #XXX we have no easy way to have a temp directory remotely! - option = py.test.config.option + option = py.test2.config.option if option.sshtarget is None: py.test.skip("no known ssh target, use -S to set one") host1 = HostInfo("%s" % (option.sshtarget, )) Modified: py/branch/event/py/test2/rsession/testing/test_master.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_master.py (original) +++ py/branch/event/py/test2/rsession/testing/test_master.py Wed Jan 30 20:38:14 2008 @@ -9,17 +9,17 @@ if sys.platform == 'win32': py.test.skip("rsession is unsupported on Windows.") -from py.__.test.rsession.master import dispatch_loop, MasterNode -from py.__.test.rsession.slave import setup_slave -from py.__.test.outcome import ReprOutcome, SerializableOutcome -from py.__.test import repevent -from py.__.test.rsession.hostmanage import HostInfo +from py.__.test2.rsession.master import dispatch_loop, MasterNode +from py.__.test2.rsession.slave import setup_slave +from py.__.test2.outcome import ReprOutcome, SerializableOutcome +from py.__.test2 import repevent +from py.__.test2.rsession.hostmanage import HostInfo def setup_module(mod): # bind an empty config - mod.tmpdir = tmpdir = py.test.ensuretemp(mod.__name__) + mod.tmpdir = tmpdir = py.test2.ensuretemp(mod.__name__) # to avoid rsyncing - config = py.test.config._reparse([tmpdir]) + config = py.test2.config._reparse([tmpdir]) config.option.dist_taskspernode = 10 mod.rootcol = config._getcollector(tmpdir) @@ -49,7 +49,7 @@ def _getremoteerror(self): return "blah" -class Item(py.test.collect.Item): +class Item(py.test2.collect.Item): def _get_collector_trail(self): return (self.name,) @@ -77,7 +77,7 @@ reportlist = [] mnode = MasterNode(ch, reportlist.append) cap = py.io.StdCaptureFD() - py.test.raises(IOError, 'mnode.send(Item("ok"))') + py.test2.raises(IOError, 'mnode.send(Item("ok"))') out, err = cap.reset() assert out.find("blah") != -1 @@ -118,7 +118,7 @@ class TestSlave: def setup_class(cls): - cls.tmpdir = tmpdir = py.test.ensuretemp(cls.__name__) + cls.tmpdir = tmpdir = py.test2.ensuretemp(cls.__name__) cls.pkgpath = pkgpath = tmpdir.join("slavetestpkg") pkgpath.ensure("__init__.py") pkgpath.join("test_something.py").write(py.code.Source(""" @@ -128,7 +128,7 @@ def funcfail(): raise AssertionError("hello world") """)) - cls.config = py.test.config._reparse([tmpdir]) + cls.config = py.test2.config._reparse([tmpdir]) assert cls.config.topdir == tmpdir cls.rootcol = cls.config._getcollector(tmpdir) @@ -153,7 +153,7 @@ host.gw_remotepath = '' host.gw = gw #gw.host.gw = gw - config = py.test.config._reparse([tmpdir]) + config = py.test2.config._reparse([tmpdir]) channel = setup_slave(host, config) mn = MasterNode(channel, simple_report) return mn @@ -182,13 +182,13 @@ gw = py.execnet.PopenGateway() gw.host = HostInfo("localhost") gw.host.gw = gw - config = py.test.config._reparse([tmpdir]) + config = py.test2.config._reparse([tmpdir]) channel = setup_slave(gw.host, config) mn = MasterNode(channel, reports.append, {}) return mn, gw, channel mn, gw, channel = open_gw() - rootcol = py.test.collect.Directory(pkgdir) + rootcol = py.test2.collect.Directory(pkgdir) funchang_item = rootcol._getitembynames(funchang_spec) mn.send(funchang_item) mn.send(StopIteration) Modified: py/branch/event/py/test2/rsession/testing/test_rest.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_rest.py (original) +++ py/branch/event/py/test2/rsession/testing/test_rest.py Wed Jan 30 20:38:14 2008 @@ -3,13 +3,13 @@ """ import py -from py.__.test.testing.test_reporter import AbstractTestReporter,\ +from py.__.test2.testing.test_reporter import AbstractTestReporter,\ DummyChannel -from py.__.test import repevent -from py.__.test.rsession.rest import RestReporter, NoLinkWriter +from py.__.test2 import repevent +from py.__.test2.rsession.rest import RestReporter, NoLinkWriter from py.__.rest.rst import * -from py.__.test.rsession.hostmanage import HostInfo -from py.__.test.outcome import SerializableOutcome +from py.__.test2.rsession.hostmanage import HostInfo +from py.__.test2.outcome import SerializableOutcome class Container(object): def __init__(self, **args): @@ -23,7 +23,7 @@ class TestRestUnits(object): def setup_method(self, method): - config = py.test.config._reparse(["some_sub"]) + config = py.test2.config._reparse(["some_sub"]) config.option.verbose = False self.config = config hosts = [HostInfo('localhost')] @@ -79,7 +79,7 @@ """ def test_report_ItemStart(self): - class FakeModule(py.test.collect.Module): + class FakeModule(py.test2.collect.Module): def __init__(self, parent): self.parent = parent self.fspath = py.path.local('.') Modified: py/branch/event/py/test2/rsession/testing/test_rsession.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_rsession.py (original) +++ py/branch/event/py/test2/rsession/testing/test_rsession.py Wed Jan 30 20:38:14 2008 @@ -3,11 +3,11 @@ """ import py -from py.__.test import repevent -from py.__.test.rsession.rsession import RSession -from py.__.test.rsession.hostmanage import HostManager, HostInfo -from py.__.test.rsession.testing.basetest import BasicRsessionTest -from py.__.test.rsession.testing.test_hostmanage import DirSetup +from py.__.test2 import repevent +from py.__.test2.rsession.rsession import RSession +from py.__.test2.rsession.hostmanage import HostManager, HostInfo +from py.__.test2.rsession.testing.basetest import BasicRsessionTest +from py.__.test2.rsession.testing.test_hostmanage import DirSetup def setup_module(mod): mod.pkgdir = py.path.local(py.__file__).dirpath() @@ -25,7 +25,7 @@ pass def test_x(): import py - py.test.skip("aaa") + py.test2.skip("aaa") def test_2(): assert 0 def test_3(): @@ -33,7 +33,7 @@ def test_4(someargs): pass """)) - config = py.test.config._reparse([self.source.join("sub"), '-x']) + config = py.test2.config._reparse([self.source.join("sub"), '-x']) allevents = [] rsession = RSession(config) rsession.main(allevents.append) @@ -42,7 +42,7 @@ assert len(testevents) == 3 def test_distribution_rsync_roots_example(self): - destdir = py.test.ensuretemp("example_dist_destdir") + destdir = py.test2.ensuretemp("example_dist_destdir") subdir = "sub_example_dist" tmpdir = self.source tmpdir.ensure(subdir, "conftest.py").write(py.code.Source(""" @@ -66,7 +66,7 @@ # assert py.__file__ != '%s' """ % (tmpdir.join(subdir), py.__file__))) destdir.join("py").mksymlinkto(py.path.local(py.__file__).dirpath()) - config = py.test.config._reparse([tmpdir.join(subdir)]) + config = py.test2.config._reparse([tmpdir.join(subdir)]) assert config.topdir == tmpdir assert not tmpdir.join("__init__.py").check() allevents = [] @@ -101,7 +101,7 @@ setup_events = [] teardown_events = [] tmpdir = self.source - config = py.test.config._reparse([tmpdir]) + config = py.test2.config._reparse([tmpdir]) hm = HostManager(config, hosts) nodes = hm.setup_hosts(setup_events.append) hm.teardown_hosts(teardown_events.append, @@ -129,7 +129,7 @@ hm = HostManager(self.config, hosts=hosts) nodes = hm.setup_hosts(allevents.append) - from py.__.test.testing.test_executor \ + from py.__.test2.testing.test_executor \ import ItemTestPassing, ItemTestFailing, ItemTestSkipping itempass = self.getexample("pass") @@ -175,7 +175,7 @@ assert os.nice(0) == 10 """) - config = py.test.config._reparse([tmpdir]) + config = py.test2.config._reparse([tmpdir]) rsession = RSession(config) rsession.main(allevents.append) testevents = [x for x in allevents @@ -184,7 +184,7 @@ assert len(passevents) == 1 def test_rsession_no_disthost(): - tmpdir = py.test.ensuretemp("rsession_no_disthost") + tmpdir = py.test2.ensuretemp("rsession_no_disthost") tmpdir.ensure("conftest.py") - config = py.test.config._reparse([str(tmpdir), '-d']) - py.test.raises(SystemExit, "config.initsession()") + config = py.test2.config._reparse([str(tmpdir), '-d']) + py.test2.raises(SystemExit, "config.initsession()") Modified: py/branch/event/py/test2/rsession/testing/test_slave.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_slave.py (original) +++ py/branch/event/py/test2/rsession/testing/test_slave.py Wed Jan 30 20:38:14 2008 @@ -1,9 +1,9 @@ """ Testing the slave side node code (in a local way). """ -from py.__.test.rsession.slave import SlaveNode, slave_main, setup -from py.__.test.outcome import ReprOutcome +from py.__.test2.rsession.slave import SlaveNode, slave_main, setup +from py.__.test2.outcome import ReprOutcome import py, sys -from py.__.test.rsession.testing.basetest import BasicRsessionTest +from py.__.test2.rsession.testing.basetest import BasicRsessionTest modlevel = [] import os @@ -13,7 +13,7 @@ # ---------------------------------------------------------------------- -from py.__.test.executor import RunExecutor +from py.__.test2.executor import RunExecutor class TestSlave(BasicRsessionTest): def gettestnode(self): Modified: py/branch/event/py/test2/rsession/testing/test_web.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_web.py (original) +++ py/branch/event/py/test2/rsession/testing/test_web.py Wed Jan 30 20:38:14 2008 @@ -15,14 +15,14 @@ mod.commproxy.USE_MOCHIKIT = False mod.rpython2javascript = rpython2javascript mod.commproxy = mod.commproxy - from py.__.test.rsession.web import TestHandler as _TestHandler - from py.__.test.rsession.web import MultiQueue + from py.__.test2.rsession.web import TestHandler as _TestHandler + from py.__.test2.rsession.web import MultiQueue mod._TestHandler = _TestHandler mod.MultiQueue = MultiQueue def test_js_generate(): - from py.__.test.rsession import webjs - from py.__.test.rsession.web import FUNCTION_LIST, IMPORTED_PYPY + from py.__.test2.rsession import webjs + from py.__.test2.rsession.web import FUNCTION_LIST, IMPORTED_PYPY source = rpython2javascript(webjs, FUNCTION_LIST, use_pdb=False) assert source @@ -36,7 +36,7 @@ assert h.parse_args('foo=bar%20baz') == {'foo': 'bar baz'} assert h.parse_args('foo%20bar=baz') == {'foo bar': 'baz'} assert h.parse_args('foo=bar%baz') == {'foo': 'bar\xbaz'} - py.test.raises(ValueError, 'h.parse_args("foo")') + py.test2.raises(ValueError, 'h.parse_args("foo")') class TestMultiQueue(object): def test_get_one_sessid(self): Modified: py/branch/event/py/test2/rsession/testing/test_webjs.py ============================================================================== --- py/branch/event/py/test/rsession/testing/test_webjs.py (original) +++ py/branch/event/py/test2/rsession/testing/test_webjs.py Wed Jan 30 20:38:14 2008 @@ -12,8 +12,8 @@ mod.dom = dom mod.schedule_callbacks = schedule_callbacks - from py.__.test.rsession import webjs - from py.__.test.rsession.web import exported_methods + from py.__.test2.rsession import webjs + from py.__.test2.rsession.web import exported_methods mod.webjs = webjs mod.exported_methods = exported_methods mod.here = py.magic.autopath().dirpath() @@ -28,8 +28,8 @@ mod.dom = dom dom.window = dom.Window(html) dom.document = dom.window.document - from py.__.test.rsession import webjs - from py.__.test.rsession.web import exported_methods + from py.__.test2.rsession import webjs + from py.__.test2.rsession.web import exported_methods mod.webjs = webjs mod.exported_methods = exported_methods Modified: py/branch/event/py/test2/rsession/web.py ============================================================================== --- py/branch/event/py/test/rsession/web.py (original) +++ py/branch/event/py/test2/rsession/web.py Wed Jan 30 20:38:14 2008 @@ -14,10 +14,10 @@ import socket import py -from py.__.test.rsession.rsession import RSession -from py.__.test import repevent -from py.__.test import collect -from py.__.test.rsession.webdata import json +from py.__.test2.rsession.rsession import RSession +from py.__.test2 import repevent +from py.__.test2 import collect +from py.__.test2.rsession.webdata import json DATADIR = py.path.local(__file__).dirpath("webdata") FUNCTION_LIST = ["main", "show_skip", "show_traceback", "show_info", "hide_info", @@ -59,7 +59,7 @@ return d class MultiQueue(object): - """ a tailor-made queue (internally using Queue) for py.test.rsession.web + """ a tailor-made queue (internally using Queue) for py.test2.rsession.web API-wise the main difference is that the get() method gets a sessid argument, which is used to determine what data to feed to the client @@ -290,7 +290,7 @@ self.pending_events.put(event) def report_ItemStart(self, event): - if isinstance(event.item, py.test.collect.Module): + if isinstance(event.item, py.test2.collect.Module): self.pending_events.put(event) def report_unknown(self, event): @@ -406,7 +406,7 @@ web_name = py.path.local(__file__).dirpath().join("webjs.py") if IMPORTED_PYPY and web_name.mtime() > js_name.mtime() or \ (not js_name.check()): - from py.__.test.rsession import webjs + from py.__.test2.rsession import webjs javascript_source = rpython2javascript(webjs, FUNCTION_LIST, use_pdb=False) Modified: py/branch/event/py/test2/rsession/webjs.py ============================================================================== --- py/branch/event/py/test/rsession/webjs.py (original) +++ py/branch/event/py/test2/rsession/webjs.py Wed Jan 30 20:38:14 2008 @@ -1,14 +1,14 @@ -""" javascript source for py.test distributed +""" javascript source for py.test2 distributed """ import py -from py.__.test.rsession.web import exported_methods +from py.__.test2.rsession.web import exported_methods try: from pypy.translator.js.modules import dom from pypy.translator.js.helper import __show_traceback except ImportError: - py.test.skip("PyPy not found") + py.test2.skip("PyPy not found") def create_elem(s): return dom.document.createElement(s) Modified: py/branch/event/py/test2/session.py ============================================================================== --- py/branch/event/py/test/session.py (original) +++ py/branch/event/py/test2/session.py Wed Jan 30 20:38:14 2008 @@ -1,11 +1,11 @@ import py import sys -from py.__.test.outcome import Outcome, Failed, Passed, Skipped -from py.__.test.reporter import choose_reporter, TestReporter -from py.__.test import repevent -from py.__.test.outcome import SerializableOutcome, ReprOutcome -from py.__.test.reporter import LocalReporter -from py.__.test.executor import RunExecutor, BoxExecutor +from py.__.test2.outcome import Outcome, Failed, Passed, Skipped +from py.__.test2.reporter import choose_reporter, TestReporter +from py.__.test2 import repevent +from py.__.test2.outcome import SerializableOutcome, ReprOutcome +from py.__.test2.reporter import LocalReporter +from py.__.test2.executor import RunExecutor, BoxExecutor """ The session implementation - reporter version: @@ -22,7 +22,7 @@ GeneratorExit = StopIteration # I think def itemgen(session, colitems, reporter, keyword=None): - stopitems = py.test.collect.Item # XXX should be generator here as well + stopitems = py.test2.collect.Item # XXX should be generator here as well while 1: if not colitems: break @@ -110,7 +110,7 @@ def footer(self, colitems): """ teardown any resources after a test run. """ - py.test.collect.Function._state.teardown_all() + py.test2.collect.Function._state.teardown_all() if not self.config.option.nomagic: py.magic.revoke(assertion=1) self.reporter(repevent.TestFinished()) Modified: py/branch/event/py/test2/terminal/remote.py ============================================================================== --- py/branch/event/py/test/terminal/remote.py (original) +++ py/branch/event/py/test2/terminal/remote.py Wed Jan 30 20:38:14 2008 @@ -1,8 +1,8 @@ from __future__ import generators import py -from py.__.test.session import Session -from py.__.test.terminal.out import getout -from py.__.test.outcome import Failed, Passed, Skipped +from py.__.test2.session import Session +from py.__.test2.terminal.out import getout +from py.__.test2.outcome import Failed, Passed, Skipped def checkpyfilechange(rootdir, statcache={}): """ wait until project files are changed. """ @@ -35,9 +35,9 @@ for rootpath, names in failures: root = py.path.local(rootpath) if root.check(dir=1): - current = py.test.collect.Directory(root).Directory(root) + current = py.test2.collect.Directory(root).Directory(root) elif root.check(file=1): - current = py.test.collect.Module(root).Module(root) + current = py.test2.collect.Module(root).Module(root) # root is fspath of names[0] -> pop names[0] # slicing works with empty lists names = names[1:] @@ -99,7 +99,7 @@ def run_remote_session(self, failures): gw, topdir = self._initslavegateway() channel = gw.remote_exec(""" - from py.__.test.terminal.remote import slaverun_TerminalSession + from py.__.test2.terminal.remote import slaverun_TerminalSession slaverun_TerminalSession(channel) """, stdout=self.out, stderr=self.out) try: @@ -123,7 +123,7 @@ print "SLAVE: initializing ..." topdir, repr, failures = channel.receive() print "SLAVE: received configuration, using topdir:", topdir - config = py.test.config + config = py.test2.config config._initdirect(topdir, repr, failures) config.option.session = None config.option.looponfailing = False Modified: py/branch/event/py/test2/testing/setupdata.py ============================================================================== --- py/branch/event/py/test/testing/setupdata.py (original) +++ py/branch/event/py/test2/testing/setupdata.py Wed Jan 30 20:38:14 2008 @@ -2,10 +2,10 @@ def setup_module(mod): mod.datadir = setupdatadir() - mod.tmpdir = py.test.ensuretemp(mod.__name__) + mod.tmpdir = py.test2.ensuretemp(mod.__name__) def setupdatadir(): - datadir = py.test.ensuretemp("datadir") + datadir = py.test2.ensuretemp("datadir") names = [x.basename for x in datadir.listdir()] for name, content in namecontent: if name not in names: @@ -55,7 +55,7 @@ def test_explicit_bad_repr(self): t = BrokenRepr1() - py.test.raises(Exception, 'repr(t)') + py.test2.raises(Exception, 'repr(t)') def test_implicit_bad_repr1(self): t = BrokenRepr1() Modified: py/branch/event/py/test2/testing/test_boxing.py ============================================================================== --- py/branch/event/py/test/testing/test_boxing.py (original) +++ py/branch/event/py/test2/testing/test_boxing.py Wed Jan 30 20:38:14 2008 @@ -7,12 +7,12 @@ if sys.platform == 'win32': py.test.skip("rsession is unsupported on Windows.") -from py.__.test.box import Box -from py.__.test.testing import example2 +from py.__.test2.box import Box +from py.__.test2.testing import example2 def setup_module(mod): - tmpdir = py.test.ensuretemp("boxtests") - mod.config = py.test.config._reparse([tmpdir]) + tmpdir = py.test2.ensuretemp("boxtests") + mod.config = py.test2.config._reparse([tmpdir]) def test_basic_boxing(): # XXX: because we do not have option transfer Modified: py/branch/event/py/test2/testing/test_collect.py ============================================================================== --- py/branch/event/py/test/testing/test_collect.py (original) +++ py/branch/event/py/test2/testing/test_collect.py Wed Jan 30 20:38:14 2008 @@ -1,9 +1,9 @@ from __future__ import generators import py from setupdata import setupdatadir -from py.__.test.outcome import Skipped, Failed, Passed, Outcome -from py.__.test.terminal.out import getout -from py.__.test.repevent import ReceivedItemOutcome +from py.__.test2.outcome import Skipped, Failed, Passed, Outcome +from py.__.test2.terminal.out import getout +from py.__.test2.repevent import ReceivedItemOutcome def getpassed(all): outcomes = [i.outcome for i in all if isinstance(i, ReceivedItemOutcome)] @@ -12,16 +12,16 @@ def setup_module(mod): mod.datadir = setupdatadir() - mod.tmpdir = py.test.ensuretemp('test_collect') + mod.tmpdir = py.test2.ensuretemp('test_collect') def test_failing_import_execfile(): dest = datadir / 'failingimport.py' - col = py.test.collect.Module(dest) - py.test.raises(ImportError, col.run) - py.test.raises(ImportError, col.run) + col = py.test2.collect.Module(dest) + py.test2.raises(ImportError, col.run) + py.test2.raises(ImportError, col.run) def test_collect_listnames_and_back(): - col1 = py.test.collect.Directory(datadir.dirpath()) + col1 = py.test2.collect.Directory(datadir.dirpath()) col2 = col1.join(datadir.basename) col3 = col2.join('filetest.py') l = col3.listnames() @@ -35,26 +35,26 @@ def test_finds_tests(): fn = datadir / 'filetest.py' - col = py.test.collect.Module(fn) + col = py.test2.collect.Module(fn) l = col.run() assert len(l) == 2 assert l[0] == 'test_one' assert l[1] == 'TestClass' def test_found_certain_testfiles(): - tmp = py.test.ensuretemp("