From fijal at codespeak.net Tue Apr 3 17:23:02 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Tue, 3 Apr 2007 17:23:02 +0200 (CEST) Subject: [py-svn] r41855 - in py/trunk/py/test: . testing Message-ID: <20070403152302.E51B21008A@code0.codespeak.net> Author: fijal Date: Tue Apr 3 17:23:00 2007 New Revision: 41855 Modified: py/trunk/py/test/defaultconftest.py py/trunk/py/test/session.py py/trunk/py/test/testing/setupdata.py py/trunk/py/test/testing/test_session.py Log: Add a bit hackish option which allows to start from selected keyword test, doesn't work with rsession yet. Modified: py/trunk/py/test/defaultconftest.py ============================================================================== --- py/trunk/py/test/defaultconftest.py (original) +++ py/trunk/py/test/defaultconftest.py Tue Apr 3 17:23:00 2007 @@ -43,6 +43,9 @@ action="store", dest="keyword", default='', help="only run test items matching the given (google-style) " "keyword expression."), + Option('-q', '--start-on', + action='store', dest='start_on', default='', + help="start from first test matching given keyword expression"), Option('-l', '--showlocals', action="store_true", dest="showlocals", default=False, help="show locals in tracebacks (disabled by default)."), Modified: py/trunk/py/test/session.py ============================================================================== --- py/trunk/py/test/session.py (original) +++ py/trunk/py/test/session.py Tue Apr 3 17:23:00 2007 @@ -8,7 +8,13 @@ """ def __init__(self, config): self._memo = [] - self.config = config + self.config = config + if config.option.start_on: + self.keyword = config.option.start_on + elif config.option.keyword: + self.keyword = config.option.keyword + else: + self.keyword = None def shouldclose(self): return False @@ -39,6 +45,9 @@ if option.executable and option.usepdb: raise ValueError, "--exec together with --pdb not supported." + if option.keyword and option.start_on: + raise ValueError, "--start-on and --keyword not supported" + def start(self, colitem): """ hook invoked before each colitem.run() invocation. """ @@ -100,11 +109,13 @@ 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.config.option.keyword) + return + if isinstance(colitem, py.test.collect.Item): + colitem._skipbykeyword(self.keyword) + if self.config.option.start_on: + self.keyword = "" res = colitem.run() - if res is None: + if res is None: return Passed() elif not isinstance(res, (list, tuple)): raise TypeError("%r.run() returned neither " Modified: py/trunk/py/test/testing/setupdata.py ============================================================================== --- py/trunk/py/test/testing/setupdata.py (original) +++ py/trunk/py/test/testing/setupdata.py Tue Apr 3 17:23:00 2007 @@ -81,6 +81,16 @@ assert 42 == 43 ''')), + ('testmore.py', py.code.Source(''' + def test_one(): + assert 1 + + def test_two(): + assert 1 + + def test_three(): + assert 1 + ''')), ('testspecial_importerror.py', py.code.Source(''' Modified: py/trunk/py/test/testing/test_session.py ============================================================================== --- py/trunk/py/test/testing/test_session.py (original) +++ py/trunk/py/test/testing/test_session.py Tue Apr 3 17:23:00 2007 @@ -11,7 +11,8 @@ conflict_options = ('--looponfailing --pdb', '--dist --pdb', - '--exec=%s --pdb' % py.std.sys.executable, + '--exec=%s --pdb' % py.std.sys.executable, + '-k xxx -q xxx', ) def test_conflict_options(): @@ -95,7 +96,18 @@ assert len(l) == 1 assert l[0][0].name == 'test_2' l = session.getitemoutcomepairs(Skipped) - assert l[0][0].name == 'test_1' + assert l[0][0].name == 'test_1' + + def test_select_starton(self): + config = py.test.config._reparse([datadir/'testmore.py', + '-q', "test_two"]) + session = config._getsessionclass()(config, py.std.sys.stdout) + session.main() + l = session.getitemoutcomepairs(Passed) + assert len(l) == 2 + l = session.getitemoutcomepairs(Skipped) + assert len(l) == 1 + class TestTerminalSession: def mainsession(self, *args): From fijal at codespeak.net Tue Apr 3 19:28:06 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Tue, 3 Apr 2007 19:28:06 +0200 (CEST) Subject: [py-svn] r41860 - in py/trunk/py/test: . testing Message-ID: <20070403172806.130A61007C@code0.codespeak.net> Author: fijal Date: Tue Apr 3 19:28:04 2007 New Revision: 41860 Modified: py/trunk/py/test/defaultconftest.py py/trunk/py/test/session.py py/trunk/py/test/testing/test_session.py Log: * kill start_on * add keyword_oneshot flag, which indicates that -k is only one shot than all tests are run * simplify code a bit Modified: py/trunk/py/test/defaultconftest.py ============================================================================== --- py/trunk/py/test/defaultconftest.py (original) +++ py/trunk/py/test/defaultconftest.py Tue Apr 3 19:28:04 2007 @@ -43,9 +43,9 @@ action="store", dest="keyword", default='', help="only run test items matching the given (google-style) " "keyword expression."), - Option('-q', '--start-on', - action='store', dest='start_on', default='', - help="start from first test matching given keyword expression"), + Option('-j', '--keyword-oneshot', + action='store_true', dest='keyword_oneshot', default=False, + help="combined with -k, runs all tests after first hit"), Option('-l', '--showlocals', action="store_true", dest="showlocals", default=False, help="show locals in tracebacks (disabled by default)."), Modified: py/trunk/py/test/session.py ============================================================================== --- py/trunk/py/test/session.py (original) +++ py/trunk/py/test/session.py Tue Apr 3 19:28:04 2007 @@ -9,12 +9,7 @@ def __init__(self, config): self._memo = [] self.config = config - if config.option.start_on: - self.keyword = config.option.start_on - elif config.option.keyword: - self.keyword = config.option.keyword - else: - self.keyword = None + self._keyword = config.option.keyword def shouldclose(self): return False @@ -45,8 +40,8 @@ if option.executable and option.usepdb: raise ValueError, "--exec together with --pdb not supported." - if option.keyword and option.start_on: - raise ValueError, "--start-on and --keyword not supported" + if option.keyword_oneshot and not option.keyword: + raise ValueError, "--keyword-oneshot makes sense only when --keyword is supplied" def start(self, colitem): """ hook invoked before each colitem.run() invocation. """ @@ -111,9 +106,9 @@ 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.start_on: - self.keyword = "" + colitem._skipbykeyword(self._keyword) + if self.config.option.keyword_oneshot: + self._keyword = "" res = colitem.run() if res is None: return Passed() Modified: py/trunk/py/test/testing/test_session.py ============================================================================== --- py/trunk/py/test/testing/test_session.py (original) +++ py/trunk/py/test/testing/test_session.py Tue Apr 3 19:28:04 2007 @@ -12,7 +12,6 @@ conflict_options = ('--looponfailing --pdb', '--dist --pdb', '--exec=%s --pdb' % py.std.sys.executable, - '-k xxx -q xxx', ) def test_conflict_options(): @@ -100,7 +99,7 @@ def test_select_starton(self): config = py.test.config._reparse([datadir/'testmore.py', - '-q', "test_two"]) + '-j', '-k', "test_two"]) session = config._getsessionclass()(config, py.std.sys.stdout) session.main() l = session.getitemoutcomepairs(Passed) From hpk at codespeak.net Mon Apr 16 12:46:25 2007 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 Apr 2007 12:46:25 +0200 (CEST) Subject: [py-svn] r42085 - py/trunk/py/doc Message-ID: <20070416104625.B93A380AC@code0.codespeak.net> Author: hpk Date: Mon Apr 16 12:46:25 2007 New Revision: 42085 Modified: py/trunk/py/doc/TODO.txt Log: adding some issues from the merlinux tracker (and removing them there) Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Mon Apr 16 12:46:25 2007 @@ -1,8 +1,31 @@ -Things to do for 0.9.0 +Things to do for 1.0.0 ========================= -* (XXX not done, but the documentation is marked accordingly) - make "_" namespace: py.log -> py._log (pypy!) + + + + + + + +ld (review and shift to above) +================================= + +refactorings +------------------ + +- session / collection unification (particularly tryiter and buildname2items) + +- refine doctests usage (particularly skips of doctests if + some imports/conditions are not satisfied) + +- generalization of "host specifications" for execnet and + py.test --dist usages in particular (see also revision 37500 which + contained a draft for that). The goal is to have cross-platform + testing and dist-testing and other usages of py.execnet all + use a common syntax for specifiying connection methods and + be able to instantiate gateways/connections through it. + packaging ------------------------------------- @@ -35,7 +58,7 @@ testing ----------- -* these should all work on 0.9 and on the py lib and pypy: +* these should all work on 1.0 and on the py lib and pypy: - running "py.test -s" - running "py.test --pdb" - running "py.test --looponfailing" @@ -57,7 +80,7 @@ * no lines longer than 80 characters * review the pylib issue tracker - (cfbolz: done: what has a 0.8.0 or a 0.9.0 tag should be looked at again) + (cfbolz: done: what has a 1.0.0 tag (or lower) should be looked at again) py.test From hpk at codespeak.net Mon Apr 16 14:37:01 2007 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 Apr 2007 14:37:01 +0200 (CEST) Subject: [py-svn] r42089 - py/trunk/py/doc Message-ID: <20070416123701.6731680BE@code0.codespeak.net> Author: hpk Date: Mon Apr 16 14:37:00 2007 New Revision: 42089 Modified: py/trunk/py/doc/TODO.txt Log: some more infos/issues put to the TODO file Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Mon Apr 16 14:37:00 2007 @@ -14,6 +14,9 @@ refactorings ------------------ +- merge py.execnet-lessthreads branch (it's working relatively + nicely, already) (M995) + - session / collection unification (particularly tryiter and buildname2items) - refine doctests usage (particularly skips of doctests if @@ -26,6 +29,23 @@ use a common syntax for specifiying connection methods and be able to instantiate gateways/connections through it. +- unification of "gateway"/host setup and teardown, including + rsyncing, i.e. cross-platform and dist-testing. + +- py.apigen tool -> separate runtime-data collection and + web page generation. (see M750), provide "py.apigen" tool + for generating API documentation + +features +-------------- + +- have a py.test scan/run database for results and test names + etc. (to allow quicker selection of tests and post-run + information on failures etc.) (M760) + +- consider features of py.apigen (recheck closed "M1016") + + packaging ------------------------------------- From hpk at codespeak.net Mon Apr 16 15:17:29 2007 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 Apr 2007 15:17:29 +0200 (CEST) Subject: [py-svn] r42092 - py/trunk/py/doc Message-ID: <20070416131729.591FE80C3@code0.codespeak.net> Author: hpk Date: Mon Apr 16 15:17:28 2007 New Revision: 42092 Modified: py/trunk/py/doc/TODO.txt Log: add rlcompleter2 / pdbplus issues Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Mon Apr 16 15:17:28 2007 @@ -45,6 +45,8 @@ - consider features of py.apigen (recheck closed "M1016") +- integrate rlcompleter2 (make it remotely workable) + and maybe integrate with "pdb" / pdbplus (M975) packaging From hpk at codespeak.net Mon Apr 16 18:19:12 2007 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 Apr 2007 18:19:12 +0200 (CEST) Subject: [py-svn] r42103 - py/trunk/py/doc Message-ID: <20070416161912.ABC3780CC@code0.codespeak.net> Author: hpk Date: Mon Apr 16 18:19:11 2007 New Revision: 42103 Modified: py/trunk/py/doc/TODO.txt Log: added some issues/features previously tracked elsewhere Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Mon Apr 16 18:19:11 2007 @@ -19,6 +19,10 @@ - session / collection unification (particularly tryiter and buildname2items) +- reporting unification, i.e. use dist-testing Reporter class + also for "normal" session, consider introduction of tkinter + session (M978) + - refine doctests usage (particularly skips of doctests if some imports/conditions are not satisfied) @@ -36,6 +40,12 @@ web page generation. (see M750), provide "py.apigen" tool for generating API documentation +- py.log: unify API, possibly deprecate duplicate ones, + base things on a Config object (hte latter almost a feature though) + (M988) + +- consider setup/teardown for generative tests (M826) + features -------------- @@ -48,6 +58,18 @@ - integrate rlcompleter2 (make it remotely workable) and maybe integrate with "pdb" / pdbplus (M975) +- integrate native collecting of unittest.py tests from py.test + (along the PyPy lib-python tests) (M987) + +- provide an automated conversion script helper for converting + unittest.py based tests to py.test ones. (M987) + +- references from ReST docs to modules, functions and classes + of apigen generated html docs (M960) + +- review svn-testing (and escape characters), consider + svn-bindings (M634) + packaging ------------------------------------- From xoraxax at codespeak.net Fri Apr 20 00:39:27 2007 From: xoraxax at codespeak.net (xoraxax at codespeak.net) Date: Fri, 20 Apr 2007 00:39:27 +0200 (CEST) Subject: [py-svn] r42188 - py/trunk/py/test Message-ID: <20070419223927.715D680AD@code0.codespeak.net> Author: xoraxax Date: Fri Apr 20 00:39:27 2007 New Revision: 42188 Added: py/trunk/py/test/compat.py Log: Revive test/compat.py again, seems to work fine for me. Can be used by patching sys.modules["unittest"] in the conftest.py file. Added: py/trunk/py/test/compat.py ============================================================================== --- (empty file) +++ py/trunk/py/test/compat.py Fri Apr 20 00:39:27 2007 @@ -0,0 +1,59 @@ +import py +from py.__.test.outcome import Failed, Passed + + +class TestCaseUnit(py.test.collect.Function): + """ compatibility Unit executor for TestCase methods + honouring setUp and tearDown semantics. + """ + def execute(self, session): + boundmethod = self.obj + instance = boundmethod.im_self + instance.setUp() + try: + boundmethod() + finally: + instance.tearDown() + return Passed() + +class TestCase(object): + """compatibility class of unittest's TestCase. """ + Function = TestCaseUnit + + def setUp(self): + pass + + def tearDown(self): + pass + + def fail(self, msg=None): + """ fail immediate with given message. """ + raise Failed(msg=msg) + + def assertRaises(self, excclass, func, *args, **kwargs): + py.test.raises(excclass, func, *args, **kwargs) + failUnlessRaises = assertRaises + + # dynamically construct (redundant) methods + aliasmap = [ + ('x', 'not x', 'assert_, failUnless'), + ('x', 'x', 'failIf'), + ('x,y', 'x!=y', 'failUnlessEqual,assertEqual, assertEquals'), + ('x,y', 'x==y', 'failIfEqual,assertNotEqual, assertNotEquals'), + ] + items = [] + for sig, expr, names in aliasmap: + names = map(str.strip, names.split(',')) + sigsubst = expr.replace('y', '%s').replace('x', '%s') + for name in names: + items.append(""" + def %(name)s(self, %(sig)s, msg=""): + __tracebackhide__ = True + if %(expr)s: + raise Failed(msg=msg + (%(sigsubst)r %% (%(sig)s))) + """ % locals() ) + + source = "".join(items) + exec py.code.Source(source).compile() + +__all__ = ['TestCase'] From fijal at codespeak.net Fri Apr 20 09:53:54 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 20 Apr 2007 09:53:54 +0200 (CEST) Subject: [py-svn] r42191 - py/trunk/py/doc Message-ID: <20070420075354.D7FC28090@code0.codespeak.net> Author: fijal Date: Fri Apr 20 09:53:54 2007 New Revision: 42191 Modified: py/trunk/py/doc/TODO.txt Log: Move several issues from merlinux tracker Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Fri Apr 20 09:53:54 2007 @@ -1,75 +1,8 @@ -Things to do for 1.0.0 +Things to do for 0.9.0 ========================= - - - - - - - -ld (review and shift to above) -================================= - -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 - also for "normal" session, consider introduction of tkinter - session (M978) - -- refine doctests usage (particularly skips of doctests if - some imports/conditions are not satisfied) - -- generalization of "host specifications" for execnet and - py.test --dist usages in particular (see also revision 37500 which - contained a draft for that). The goal is to have cross-platform - testing and dist-testing and other usages of py.execnet all - use a common syntax for specifiying connection methods and - be able to instantiate gateways/connections through it. - -- unification of "gateway"/host setup and teardown, including - rsyncing, i.e. cross-platform and dist-testing. - -- py.apigen tool -> separate runtime-data collection and - web page generation. (see M750), provide "py.apigen" tool - for generating API documentation - -- py.log: unify API, possibly deprecate duplicate ones, - base things on a Config object (hte latter almost a feature though) - (M988) - -- consider setup/teardown for generative tests (M826) - -features --------------- - -- have a py.test scan/run database for results and test names - etc. (to allow quicker selection of tests and post-run - information on failures etc.) (M760) - -- consider features of py.apigen (recheck closed "M1016") - -- integrate rlcompleter2 (make it remotely workable) - and maybe integrate with "pdb" / pdbplus (M975) - -- integrate native collecting of unittest.py tests from py.test - (along the PyPy lib-python tests) (M987) - -- provide an automated conversion script helper for converting - unittest.py based tests to py.test ones. (M987) - -- references from ReST docs to modules, functions and classes - of apigen generated html docs (M960) - -- review svn-testing (and escape characters), consider - svn-bindings (M634) - +* (XXX not done, but the documentation is marked accordingly) + make "_" namespace: py.log -> py._log (pypy!) packaging ------------------------------------- @@ -102,7 +35,7 @@ testing ----------- -* these should all work on 1.0 and on the py lib and pypy: +* these should all work on 0.9 and on the py lib and pypy: - running "py.test -s" - running "py.test --pdb" - running "py.test --looponfailing" @@ -124,7 +57,7 @@ * no lines longer than 80 characters * review the pylib issue tracker - (cfbolz: done: what has a 1.0.0 tag (or lower) should be looked at again) + (cfbolz: done: what has a 0.8.0 or a 0.9.0 tag should be looked at again) py.test @@ -137,6 +70,10 @@ * (postponed, likely) py.test fails to parse strangely formatted code after assertion failure +* teardown happens a bit late to do proper I/O and error catching. + +* generators need to be rethinked a bit (my POV http://codespeak.net/pipermail/py-dev/2007q1/000789.html) + Missing docstrings ------------------ From fijal at codespeak.net Fri Apr 20 10:01:00 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 20 Apr 2007 10:01:00 +0200 (CEST) Subject: [py-svn] r42193 - py/trunk/py/doc Message-ID: <20070420080100.8BD2C80B5@code0.codespeak.net> Author: fijal Date: Fri Apr 20 10:01:00 2007 New Revision: 42193 Modified: py/trunk/py/doc/TODO.txt Log: revert my changes Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Fri Apr 20 10:01:00 2007 @@ -1,8 +1,75 @@ -Things to do for 0.9.0 +Things to do for 1.0.0 ========================= -* (XXX not done, but the documentation is marked accordingly) - make "_" namespace: py.log -> py._log (pypy!) + + + + + + + +ld (review and shift to above) +================================= + +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 + also for "normal" session, consider introduction of tkinter + session (M978) + +- refine doctests usage (particularly skips of doctests if + some imports/conditions are not satisfied) + +- generalization of "host specifications" for execnet and + py.test --dist usages in particular (see also revision 37500 which + contained a draft for that). The goal is to have cross-platform + testing and dist-testing and other usages of py.execnet all + use a common syntax for specifiying connection methods and + be able to instantiate gateways/connections through it. + +- unification of "gateway"/host setup and teardown, including + rsyncing, i.e. cross-platform and dist-testing. + +- py.apigen tool -> separate runtime-data collection and + web page generation. (see M750), provide "py.apigen" tool + for generating API documentation + +- py.log: unify API, possibly deprecate duplicate ones, + base things on a Config object (hte latter almost a feature though) + (M988) + +- consider setup/teardown for generative tests (M826) + +features +-------------- + +- have a py.test scan/run database for results and test names + etc. (to allow quicker selection of tests and post-run + information on failures etc.) (M760) + +- consider features of py.apigen (recheck closed "M1016") + +- integrate rlcompleter2 (make it remotely workable) + and maybe integrate with "pdb" / pdbplus (M975) + +- integrate native collecting of unittest.py tests from py.test + (along the PyPy lib-python tests) (M987) + +- provide an automated conversion script helper for converting + unittest.py based tests to py.test ones. (M987) + +- references from ReST docs to modules, functions and classes + of apigen generated html docs (M960) + +- review svn-testing (and escape characters), consider + svn-bindings (M634) + packaging ------------------------------------- @@ -35,7 +102,7 @@ testing ----------- -* these should all work on 0.9 and on the py lib and pypy: +* these should all work on 1.0 and on the py lib and pypy: - running "py.test -s" - running "py.test --pdb" - running "py.test --looponfailing" @@ -57,7 +124,7 @@ * no lines longer than 80 characters * review the pylib issue tracker - (cfbolz: done: what has a 0.8.0 or a 0.9.0 tag should be looked at again) + (cfbolz: done: what has a 1.0.0 tag (or lower) should be looked at again) py.test @@ -70,10 +137,6 @@ * (postponed, likely) py.test fails to parse strangely formatted code after assertion failure -* teardown happens a bit late to do proper I/O and error catching. - -* generators need to be rethinked a bit (my POV http://codespeak.net/pipermail/py-dev/2007q1/000789.html) - Missing docstrings ------------------ From fijal at codespeak.net Fri Apr 20 10:02:38 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Fri, 20 Apr 2007 10:02:38 +0200 (CEST) Subject: [py-svn] r42194 - py/trunk/py/doc Message-ID: <20070420080238.E39AB80B5@code0.codespeak.net> Author: fijal Date: Fri Apr 20 10:02:38 2007 New Revision: 42194 Modified: py/trunk/py/doc/TODO.txt Log: Add my notes (this time for real) Modified: py/trunk/py/doc/TODO.txt ============================================================================== --- py/trunk/py/doc/TODO.txt (original) +++ py/trunk/py/doc/TODO.txt Fri Apr 20 10:02:38 2007 @@ -46,6 +46,9 @@ - consider setup/teardown for generative tests (M826) +- fix teardown problems regarding when teardown is done (should be done + after test run, not before the next one) + features -------------- From xoraxax at codespeak.net Fri Apr 20 18:40:39 2007 From: xoraxax at codespeak.net (xoraxax at codespeak.net) Date: Fri, 20 Apr 2007 18:40:39 +0200 (CEST) Subject: [py-svn] r42215 - in py/trunk/py/test: . testing Message-ID: <20070420164039.4581380B8@code0.codespeak.net> Author: xoraxax Date: Fri Apr 20 18:40:39 2007 New Revision: 42215 Added: py/trunk/py/test/compat.py - copied, changed from r11506, py/dist/py/test/compat.py py/trunk/py/test/testing/test_compat.py - copied, changed from r11506, py/dist/py/test/testing/test_compat.py Log: Copy with SVN history and restore test. Copied: py/trunk/py/test/compat.py (from r11506, py/dist/py/test/compat.py) ============================================================================== --- py/dist/py/test/compat.py (original) +++ py/trunk/py/test/compat.py Fri Apr 20 18:40:39 2007 @@ -1,7 +1,8 @@ -from __future__ import generators import py +from py.__.test.outcome import Failed, Passed -class TestCaseUnit(py.test.Function): + +class TestCaseUnit(py.test.collect.Function): """ compatibility Unit executor for TestCase methods honouring setUp and tearDown semantics. """ @@ -13,9 +14,9 @@ boundmethod() finally: instance.tearDown() - return py.test.Item.Passed() + return Passed() -class TestCase: +class TestCase(object): """compatibility class of unittest's TestCase. """ Function = TestCaseUnit @@ -27,7 +28,7 @@ def fail(self, msg=None): """ fail immediate with given message. """ - raise py.test.Item.Failed(msg=msg) + raise Failed(msg=msg) def assertRaises(self, excclass, func, *args, **kwargs): py.test.raises(excclass, func, *args, **kwargs) @@ -46,10 +47,10 @@ sigsubst = expr.replace('y', '%s').replace('x', '%s') for name in names: items.append(""" - def %(name)s(self, %(sig)s): + def %(name)s(self, %(sig)s, msg=""): __tracebackhide__ = True if %(expr)s: - raise py.test.Item.Failed(msg=%(sigsubst)r %% (%(sig)s)) + raise Failed(msg=msg + (%(sigsubst)r %% (%(sig)s))) """ % locals() ) source = "".join(items) Copied: py/trunk/py/test/testing/test_compat.py (from r11506, py/dist/py/test/testing/test_compat.py) ============================================================================== --- py/dist/py/test/testing/test_compat.py (original) +++ py/trunk/py/test/testing/test_compat.py Fri Apr 20 18:40:39 2007 @@ -1,7 +1,9 @@ from __future__ import generators import py +from py.__.test.compat import TestCase +from py.__.test.outcome import Failed -class TestCompatTestCaseSetupSemantics(py.test.compat.TestCase): +class TestCompatTestCaseSetupSemantics(TestCase): globlist = [] def setUp(self): @@ -27,7 +29,7 @@ # for x,y in zip(self.globlist, self.globlist[1:]): # assert x is not y -class TestCompatAssertions(py.test.compat.TestCase): +class TestCompatAssertions(TestCase): nameparamdef = { 'failUnlessEqual,assertEqual,assertEquals': ('1, 1', '1, 0'), 'assertNotEquals,failIfEqual': ('0, 1', '0,0'), @@ -44,7 +46,7 @@ #self.%(name)s(%(paramfail)s) def test_%(name)s_failing(self): - self.assertRaises(py.test.Item.Failed, + self.assertRaises(Failed, self.%(name)s, %(paramfail)s) """ % locals() co = py.code.Source(source).compile() From fijal at codespeak.net Mon Apr 23 19:41:43 2007 From: fijal at codespeak.net (fijal at codespeak.net) Date: Mon, 23 Apr 2007 19:41:43 +0200 (CEST) Subject: [py-svn] r42273 - py/trunk/py/doc Message-ID: <20070423174143.592E6809A@code0.codespeak.net> Author: fijal Date: Mon Apr 23 19:41:43 2007 New Revision: 42273 Added: py/trunk/py/doc/apigen_refactorings.txt Log: Added a file about what I would like to have in apigen. Added: py/trunk/py/doc/apigen_refactorings.txt ============================================================================== --- (empty file) +++ py/trunk/py/doc/apigen_refactorings.txt Mon Apr 23 19:41:43 2007 @@ -0,0 +1,35 @@ + +Proposed apigen refactorings +============================= + +First of all we would like to have some kind of a persistent storage +for apigen, so we could use it for different purposes (hint! hint! pdb) +than only web pages. This will resolve the issue of having separated +apigen "data" generation and web page generation. + +Apigen is very usefull feature, but we don't use it in general. Which +is bad. One of the reasons is above and the other one is that API of +apigen is not that well defined which makes it harder to use. So what +I think would be: + +* **py.apigen** tool, which will take tests and initpkg (or whatever + means of collecting data) and will try to store it somewhere + (not sure, plain text log as a first step?). Than next step + would be to have tools for generating webpages out of it + (py.webapi or so) and other tools which will integrate it to pdb, + emacs (pick your random IDE here) or whatever. + +* Another option is to have py.test generate those data and have another + tools using it. + +* Data storage. Text with a log comes in mind, but it's not very handy. + Using any sort of SQL doesn't really counts, cause it makes pylib + less standalone, especially that I wouldn't like to have write all + those SQL myself, but rather use some kind of sql object relational + mapper. Another format might be some kind of structured text + (xml anyone?) or pickled stuff. Pickle has problems on his own, + so I don't have any best solution at hand. + +* Accessing. These are all strings and simple types built on top of it. + Probably would be good not to store all data in memory, because it might + be huge in case we would like to have all past informations there.