From py-svn at codespeak.net Sat Sep 15 01:52:12 2007 From: py-svn at codespeak.net (Viagra.com Inc ®) Date: Sat, 15 Sep 2007 01:52:12 +0200 (CEST) Subject: [py-svn] Official Site Message-ID: <992982481749.571397332.30499216858928-8276@cimail041.msn.com> An HTML attachment was scrubbed... URL: From guido at codespeak.net Mon Sep 17 14:22:44 2007 From: guido at codespeak.net (guido at codespeak.net) Date: Mon, 17 Sep 2007 14:22:44 +0200 (CEST) Subject: [py-svn] r46692 - in py/trunk/py/path/svn: . testing Message-ID: <20070917122244.8572D80EA@code0.codespeak.net> Author: guido Date: Mon Sep 17 14:22:39 2007 New Revision: 46692 Modified: py/trunk/py/path/svn/testing/test_urlcommand.py py/trunk/py/path/svn/testing/test_wccommand.py py/trunk/py/path/svn/urlcommand.py Log: Added 'export()' method to py.path.svnurl. Modified: py/trunk/py/path/svn/testing/test_urlcommand.py ============================================================================== --- py/trunk/py/path/svn/testing/test_urlcommand.py (original) +++ py/trunk/py/path/svn/testing/test_urlcommand.py Mon Sep 17 14:22:39 2007 @@ -59,6 +59,44 @@ py.test.skip('XXX fixme win32') py.test.raises(ValueError, 'py.path.svnurl("http://host.com/foo:bar")') + def test_export(self): + repo, wc = getrepowc('test_export_repo', 'test_export_wc') + foo = wc.join('foo').ensure(dir=True) + bar = foo.join('bar').ensure(file=True) + bar.write('bar\n') + foo.commit('testing something') + exportpath = py.test.ensuretemp('test_export_exportdir') + url = py.path.svnurl(repo + '/foo') + foo = url.export(exportpath.join('foo')) + assert foo == exportpath.join('foo') + assert isinstance(foo, py.path.local) + assert foo.join('bar').check() + assert not foo.join('.svn').check() + + def test_export_rev(self): + repo, wc = getrepowc('test_export_rev_repo', 'test_export_rev_wc') + foo = wc.join('foo').ensure(dir=True) + bar = foo.join('bar').ensure(file=True) + bar.write('bar\n') + rev1 = foo.commit('testing something') + print 'rev1:', rev1 + baz = foo.join('baz').ensure(file=True) + baz.write('baz\n') + rev2 = foo.commit('testing more') + + exportpath = py.test.ensuretemp('test_export_rev_exportdir') + url = py.path.svnurl(repo + '/foo', rev=rev1) + foo1 = url.export(exportpath.join('foo1')) + assert foo1.check() + assert foo1.join('bar').check() + assert not foo1.join('baz').check() + + url = py.path.svnurl(repo + '/foo', rev=rev2) + foo2 = url.export(exportpath.join('foo2')) + assert foo2.check() + assert foo2.join('bar').check() + assert foo2.join('baz').check() + class TestSvnInfoCommand: def test_svn_1_2(self): Modified: py/trunk/py/path/svn/testing/test_wccommand.py ============================================================================== --- py/trunk/py/path/svn/testing/test_wccommand.py (original) +++ py/trunk/py/path/svn/testing/test_wccommand.py Mon Sep 17 14:22:39 2007 @@ -270,6 +270,19 @@ assert len(status.prop_modified) == 0 assert len(status.modified) == 0 + def test_commit_return_value(self): + root = self.root + testfile = root.join('test.txt').ensure(file=True) + testfile.write('test') + rev = root.commit('testing') + assert type(rev) == int + + anotherfile = root.join('another.txt').ensure(file=True) + anotherfile.write('test') + rev2 = root.commit('testing more') + assert type(rev2) == int + assert rev2 == rev + 1 + #def test_log(self): # l = self.root.log() # assert len(l) == 3 # might need to be upped if more tests are added Modified: py/trunk/py/path/svn/urlcommand.py ============================================================================== --- py/trunk/py/path/svn/urlcommand.py (original) +++ py/trunk/py/path/svn/urlcommand.py Mon Sep 17 14:22:39 2007 @@ -132,6 +132,20 @@ process.cmdexec('svn rm -m "%s" "%s"' %(msg, self._escape(self))) self._lsnorevcache.delentry(self.dirpath().strpath) + def export(self, topath): + """ export to a local path + + topath should not exist prior to calling this, returns a + py.path.local instance + """ + topath = py.path.local(topath) + args = ['"%s"' % (self._escape(self),), + '"%s"' % (self._escape(topath),)] + if self.rev is not None: + args = ['-r', str(self.rev)] + args + process.cmdexec('svn export %s' % (' '.join(args),)) + return topath + def ensure(self, *args, **kwargs): """ ensure that an args-joined path exists (by default as a file). If you specify a keyword argument 'dir=True' From cfbolz at codespeak.net Thu Sep 20 17:17:23 2007 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 20 Sep 2007 17:17:23 +0200 (CEST) Subject: [py-svn] r46770 - in py/trunk/py: . builtin builtin/testing test/rsession Message-ID: <20070920151723.D73F78170@code0.codespeak.net> Author: cfbolz Date: Thu Sep 20 17:17:22 2007 New Revision: 46770 Modified: py/trunk/py/__init__.py py/trunk/py/builtin/exception.py py/trunk/py/builtin/testing/test_exception.py py/trunk/py/test/rsession/master.py Log: add py.builtin.GeneratorExit, to make it possible to write 2.3 and 2.4 compatible code. The exception is never raised there. Modified: py/trunk/py/__init__.py ============================================================================== --- py/trunk/py/__init__.py (original) +++ py/trunk/py/__init__.py Thu Sep 20 17:17:22 2007 @@ -33,6 +33,7 @@ '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 'test.config' : ('./test/config.py', 'config_per_process'), @@ -92,6 +93,7 @@ 'builtin.reversed' : ('./builtin/reversed.py', 'reversed'), 'builtin.sorted' : ('./builtin/sorted.py', 'sorted'), 'builtin.BaseException' : ('./builtin/exception.py', 'BaseException'), + 'builtin.GeneratorExit' : ('./builtin/exception.py', 'GeneratorExit'), 'builtin.set' : ('./builtin/set.py', 'set'), 'builtin.frozenset' : ('./builtin/set.py', 'frozenset'), Modified: py/trunk/py/builtin/exception.py ============================================================================== --- py/trunk/py/builtin/exception.py (original) +++ py/trunk/py/builtin/exception.py Thu Sep 20 17:17:22 2007 @@ -2,3 +2,12 @@ BaseException = BaseException except NameError: BaseException = Exception + +try: + GeneratorExit = GeneratorExit +except NameError: + class GeneratorExit(Exception): + """ This exception is never raised, it is there to make it possible to + write code compatible with CPython 2.5 even in lower CPython + versions.""" + pass Modified: py/trunk/py/builtin/testing/test_exception.py ============================================================================== --- py/trunk/py/builtin/testing/test_exception.py (original) +++ py/trunk/py/builtin/testing/test_exception.py Thu Sep 20 17:17:22 2007 @@ -11,3 +11,8 @@ assert py.builtin.BaseException.__module__ == 'exceptions' assert Exception.__name__ == 'Exception' + + +def test_GeneratorExit(): + assert py.builtin.GeneratorExit.__module__ == 'exceptions' + assert issubclass(py.builtin.GeneratorExit, Exception) Modified: py/trunk/py/test/rsession/master.py ============================================================================== --- py/trunk/py/test/rsession/master.py (original) +++ py/trunk/py/test/rsession/master.py Thu Sep 20 17:17:22 2007 @@ -5,6 +5,7 @@ from py.__.test.outcome import ReprOutcome from py.__.test import repevent from py.__.test.outcome import Skipped +from py.builtin import GeneratorExit class MasterNode(object): def __init__(self, channel, reporter): From cfbolz at codespeak.net Thu Sep 20 17:20:46 2007 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 20 Sep 2007 17:20:46 +0200 (CEST) Subject: [py-svn] r46771 - py/trunk/py Message-ID: <20070920152046.064D78100@code0.codespeak.net> Author: cfbolz Date: Thu Sep 20 17:20:45 2007 New Revision: 46771 Modified: py/trunk/py/__init__.py Log: remove nonsense __init__.py line -- belongs to the next checkin Modified: py/trunk/py/__init__.py ============================================================================== --- py/trunk/py/__init__.py (original) +++ py/trunk/py/__init__.py Thu Sep 20 17:20:45 2007 @@ -33,7 +33,6 @@ '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 'test.config' : ('./test/config.py', 'config_per_process'), From cfbolz at codespeak.net Thu Sep 20 17:26:09 2007 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 20 Sep 2007 17:26:09 +0200 (CEST) Subject: [py-svn] r46772 - in py/trunk/py/test: . rsession rsession/testing terminal Message-ID: <20070920152609.C621E817B@code0.codespeak.net> Author: cfbolz Date: Thu Sep 20 17:26:09 2007 New Revision: 46772 Added: py/trunk/py/test/custompdb.py Modified: py/trunk/py/test/rsession/executor.py py/trunk/py/test/rsession/testing/test_lsession.py py/trunk/py/test/terminal/terminal.py Log: add a custom pdb.Pdb subclass that has the ability to properly list the lines generated by py.code.Source. Very useful in PyPy debugging. Added: py/trunk/py/test/custompdb.py ============================================================================== --- (empty file) +++ py/trunk/py/test/custompdb.py Thu Sep 20 17:26:09 2007 @@ -0,0 +1,72 @@ +import pdb, sys, linecache + +class Pdb(pdb.Pdb): + def do_list(self, arg): + self.lastcmd = 'list' + last = None + if arg: + try: + x = eval(arg, {}, {}) + if type(x) == type(()): + first, last = x + first = int(first) + last = int(last) + if last < first: + # Assume it's a count + last = first + last + else: + first = max(1, int(x) - 5) + except: + print '*** Error in argument:', repr(arg) + return + elif self.lineno is None: + first = max(1, self.curframe.f_lineno - 5) + else: + first = self.lineno + 1 + if last is None: + last = first + 10 + filename = self.curframe.f_code.co_filename + breaklist = self.get_file_breaks(filename) + try: + for lineno in range(first, last+1): + # start difference from normal do_line + line = self._getline(filename, lineno) + # end difference from normal do_line + if not line: + print '[EOF]' + break + else: + s = repr(lineno).rjust(3) + if len(s) < 4: s = s + ' ' + if lineno in breaklist: s = s + 'B' + else: s = s + ' ' + if lineno == self.curframe.f_lineno: + s = s + '->' + print s + '\t' + line, + self.lineno = lineno + except KeyboardInterrupt: + pass + do_l = do_list + + def _getline(self, filename, lineno): + if hasattr(filename, "__source__"): + try: + return filename.__source__.lines[lineno - 1] + "\n" + except IndexError: + return None + return linecache.getline(filename, lineno) + +def post_mortem(t): + # again, a copy of the version in pdb.py + t = outcome.excinfo._excinfo[2] + p = Pdb() + p.reset() + while t.tb_next is not None: + t = t.tb_next + p.interaction(t.tb_frame, t) + +def set_trace(): + # again, a copy of the version in pdb.py + Pdb().set_trace(sys._getframe().f_back) + + Modified: py/trunk/py/test/rsession/executor.py ============================================================================== --- py/trunk/py/test/rsession/executor.py (original) +++ py/trunk/py/test/rsession/executor.py Thu Sep 20 17:26:09 2007 @@ -7,6 +7,7 @@ from py.__.test.rsession.box import Box from py.__.test import repevent from py.__.test.outcome import Skipped, Failed +import py.__.test.custompdb class RunExecutor(object): """ Same as in executor, but just running run @@ -55,8 +56,7 @@ self.reporter(repevent.ImmediateFailure(self.item, ReprOutcome(outcome.make_repr (self.config.option.tbstyle)))) - import pdb - pdb.post_mortem(excinfo._excinfo[2]) + py.__.test.custompdb.post_mortem(excinfo._excinfo[2]) # XXX hmm, we probably will not like to continue from that # point raise SystemExit() Modified: py/trunk/py/test/rsession/testing/test_lsession.py ============================================================================== --- py/trunk/py/test/rsession/testing/test_lsession.py (original) +++ py/trunk/py/test/rsession/testing/test_lsession.py Thu Sep 20 17:26:09 2007 @@ -6,6 +6,7 @@ from py.__.test.rsession.rsession import LSession from py.__.test import repevent from py.__.test.rsession.local import box_runner, plain_runner, apigen_runner +import py.__.test.custompdb def setup_module(mod): mod.tmp = py.test.ensuretemp("lsession_module") @@ -78,14 +79,13 @@ def test_1(): assert 0 """)) - import pdb l = [] def some_fun(*args): l.append(args) try: - post_mortem = pdb.post_mortem - pdb.post_mortem = some_fun + post_mortem = py.__.test.custompdb.post_mortem + py.__.test.custompdb.post_mortem = some_fun args = [str(tmpdir.join(subdir)), '--pdb'] config = py.test.config._reparse(args) lsession = LSession(config) @@ -101,7 +101,7 @@ assert len(failure_events) == 1 assert len(l) == 1 finally: - pdb.post_mortem = post_mortem + py.__.test.custompdb.post_mortem = post_mortem def test_minus_x(self): if not hasattr(py.std.os, 'fork'): Modified: py/trunk/py/test/terminal/terminal.py ============================================================================== --- py/trunk/py/test/terminal/terminal.py (original) +++ py/trunk/py/test/terminal/terminal.py Thu Sep 20 17:26:09 2007 @@ -4,6 +4,7 @@ from py.__.test.terminal.out import getout from py.__.test.representation import Presenter from py.__.test.outcome import Skipped, Passed, Failed +import py.__.test.custompdb def getrelpath(source, dest): base = source.common(dest) @@ -97,9 +98,8 @@ if isinstance(outcome, Failed): print "dispatching to ppdb", colitem self.repr_failure(colitem, outcome) - import pdb self.out.write('\n%s\n' % (outcome.excinfo.exconly(),)) - pdb.post_mortem(outcome.excinfo._excinfo[2]) + py.__.test.custompdb.post_mortem(excinfo._excinfo[2]) if isinstance(colitem, py.test.collect.Module): resultstring = self.repr_progress_module_result(colitem, outcome) if resultstring: From py-svn at codespeak.net Thu Sep 20 22:28:08 2007 From: py-svn at codespeak.net (Viagra.com Inc) Date: Thu, 20 Sep 2007 22:28:08 +0200 (CEST) Subject: [py-svn] Lovers package at discount price! Message-ID: <20070920112940.3410.qmail@host30-221-dynamic.11-79-r.retail.telecomitalia.it> An HTML attachment was scrubbed... URL: From cfbolz at codespeak.net Fri Sep 21 15:29:26 2007 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 21 Sep 2007 15:29:26 +0200 (CEST) Subject: [py-svn] r46794 - in py/trunk/py/test: . terminal Message-ID: <20070921132926.ED9818195@code0.codespeak.net> Author: cfbolz Date: Fri Sep 21 15:29:26 2007 New Revision: 46794 Modified: py/trunk/py/test/custompdb.py py/trunk/py/test/terminal/terminal.py Log: embarassing typo Modified: py/trunk/py/test/custompdb.py ============================================================================== --- py/trunk/py/test/custompdb.py (original) +++ py/trunk/py/test/custompdb.py Fri Sep 21 15:29:26 2007 @@ -58,7 +58,6 @@ def post_mortem(t): # again, a copy of the version in pdb.py - t = outcome.excinfo._excinfo[2] p = Pdb() p.reset() while t.tb_next is not None: Modified: py/trunk/py/test/terminal/terminal.py ============================================================================== --- py/trunk/py/test/terminal/terminal.py (original) +++ py/trunk/py/test/terminal/terminal.py Fri Sep 21 15:29:26 2007 @@ -99,7 +99,7 @@ print "dispatching to ppdb", colitem self.repr_failure(colitem, outcome) self.out.write('\n%s\n' % (outcome.excinfo.exconly(),)) - py.__.test.custompdb.post_mortem(excinfo._excinfo[2]) + py.__.test.custompdb.post_mortem(outcome.excinfo._excinfo[2]) if isinstance(colitem, py.test.collect.Module): resultstring = self.repr_progress_module_result(colitem, outcome) if resultstring: From py-svn at codespeak.net Mon Sep 24 13:35:45 2007 From: py-svn at codespeak.net (Viagra.com Inc) Date: Mon, 24 Sep 2007 13:35:45 +0200 (CEST) Subject: [py-svn] September 70% OFF Message-ID: <20070924024545.29736.qmail@adsl203-148-020.mclink.it> An HTML attachment was scrubbed... URL: From py-svn at codespeak.net Wed Sep 26 18:44:05 2007 From: py-svn at codespeak.net (Viagra.com Inc) Date: Wed, 26 Sep 2007 18:44:05 +0200 (CEST) Subject: [py-svn] September 70% OFF Message-ID: <20070926074611.13918.qmail@AOrleans-258-1-116-100.w90-21.abo.wanadoo.fr> An HTML attachment was scrubbed... URL: From py-svn at codespeak.net Thu Sep 27 12:09:34 2007 From: py-svn at codespeak.net (Viagra.com Inc) Date: Thu, 27 Sep 2007 12:09:34 +0200 (CEST) Subject: [py-svn] September 70% OFF Message-ID: <20070927131150.3622.qmail@bloki1.nasze.pl> An HTML attachment was scrubbed... URL: From py-svn at codespeak.net Fri Sep 28 19:50:11 2007 From: py-svn at codespeak.net (Viagra.com Inc) Date: Fri, 28 Sep 2007 19:50:11 +0200 (CEST) Subject: [py-svn] September 70% OFF Message-ID: <20070928-45227.2954.qmail@adsl-9-0-28.mia.bellsouth.net> An HTML attachment was scrubbed... URL: