8 new commits in py:

https://bitbucket.org/hpk42/py/changeset/1d0f65a07a1c/
changeset:   1d0f65a07a1c
user:        RonnyPfannschmidt
date:        2011-11-23 08:40:27
summary:     make traceback recursion detection more resilent about the eval 
magic of a decorator lib
affected #:  2 files

diff -r c8e97602a6cb3a2b3332f1bb3f76a857bfa7c5fa -r 
1d0f65a07a1c1673d45fbe984dadf74a1780f83b CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,8 @@
 
 - fix issue7: source.getstatementrange() now raises proper error
   if no valid statement can be found
+- make trackeback recursion detection more resilent
+  about the eval magic of a decorator library
 
 Changes between 1.4.4 and 1.4.5
 ==================================================


diff -r c8e97602a6cb3a2b3332f1bb3f76a857bfa7c5fa -r 
1d0f65a07a1c1673d45fbe984dadf74a1780f83b py/_code/code.py
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -283,7 +283,11 @@
         """
         cache = {}
         for i, entry in enumerate(self):
-            key = entry.frame.code.path, entry.lineno
+            # id for the code.raw is needed to work around 
+            # the strange metaprogramming in the decorator lib from pypi
+            # which generates code objects that have hash/value equality
+            #XXX needs a test
+            key = entry.frame.code.path, id(entry.frame.code.raw), entry.lineno
             #print "checking for recursion at", key
             l = cache.setdefault(key, [])
             if l:



https://bitbucket.org/hpk42/py/changeset/214561f55dfc/
changeset:   214561f55dfc
user:        RonnyPfannschmidt
date:        2011-11-23 08:42:25
summary:     add py.builtin.next
affected #:  4 files

diff -r 1d0f65a07a1c1673d45fbe984dadf74a1780f83b -r 
214561f55dfcc96014618ae1cf5d83ec6e9619a7 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
   if no valid statement can be found
 - make trackeback recursion detection more resilent
   about the eval magic of a decorator library
+- add py.builtin.next
 
 Changes between 1.4.4 and 1.4.5
 ==================================================


diff -r 1d0f65a07a1c1673d45fbe984dadf74a1780f83b -r 
214561f55dfcc96014618ae1cf5d83ec6e9619a7 py/__init__.py
--- a/py/__init__.py
+++ b/py/__init__.py
@@ -104,6 +104,7 @@
         'builtins'       : '._builtin:builtins',
         'execfile'       : '._builtin:execfile',
         'callable'       : '._builtin:callable',
+        'next'           : '._builtin:next',
     },
 
     # input-output helping


diff -r 1d0f65a07a1c1673d45fbe984dadf74a1780f83b -r 
214561f55dfcc96014618ae1cf5d83ec6e9619a7 py/_builtin.py
--- a/py/_builtin.py
+++ b/py/_builtin.py
@@ -91,6 +91,22 @@
 enumerate = enumerate
 
 try:
+    next = next
+except NameError:
+    _next_noarg = object()
+    def next(it, default=_next_noarg):
+        try:
+            if hasattr(it, '__next__'):
+                return it.__next__()
+            else:
+                return it.next()
+        except StopIteration:
+            if default is _next_noarg:
+                raise
+            else:
+                return default
+
+try:
     BaseException = BaseException
 except NameError:
     BaseException = Exception


diff -r 1d0f65a07a1c1673d45fbe984dadf74a1780f83b -r 
214561f55dfcc96014618ae1cf5d83ec6e9619a7 testing/root/test_builtin.py
--- a/testing/root/test_builtin.py
+++ b/testing/root/test_builtin.py
@@ -1,7 +1,7 @@
 import sys
 import types
 import py
-from py.builtin import set, frozenset, reversed, sorted
+from py.builtin import set, frozenset, reversed, sorted, next
 
 def test_enumerate():
     l = [0,1,2]
@@ -160,3 +160,22 @@
     code = py.builtin._getcode(test_getcode)
     assert isinstance(code, types.CodeType)
     assert py.builtin._getcode(4) is None
+
+def test_next():
+    it = iter([])
+    py.test.raises(StopIteraton, next, it)
+    it = iter('1')
+    n = next(it)
+    assert n ==  '1'
+    py.test.raises(StopIteraton, next, it)
+
+    class new_next(object):
+        def __next__(self):
+            return 1
+    assert next(new_next()) == 1
+
+    class old_next(object):
+        def next(self):
+            return 1
+    assert next(old_next) == 1
+



https://bitbucket.org/hpk42/py/changeset/7671e4e54b2e/
changeset:   7671e4e54b2e
user:        RonnyPfannschmidt
date:        2011-11-23 09:56:59
summary:     make source.getstatementrange() resilent against non-python like 
jinja2
affected #:  3 files

diff -r 214561f55dfcc96014618ae1cf5d83ec6e9619a7 -r 
7671e4e54b2e8107679b6c343c8fcf22b843668a CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,8 @@
 
 - fix issue7: source.getstatementrange() now raises proper error
   if no valid statement can be found
+- make source.getstatementrange() more resilent about non-python code frames
+  (as seen from jnja2)
 - make trackeback recursion detection more resilent
   about the eval magic of a decorator library
 - add py.builtin.next


diff -r 214561f55dfcc96014618ae1cf5d83ec6e9619a7 -r 
7671e4e54b2e8107679b6c343c8fcf22b843668a py/_code/code.py
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -171,6 +171,8 @@
             _, end = source.getstatementrange(end)
         except IndexError:
             end = self.lineno + 1
+        except ValueError:
+            pass
         # heuristic to stop displaying source on e.g.
         #   if something:  # assume this causes a NameError
         #      # _this_ lines and the one


diff -r 214561f55dfcc96014618ae1cf5d83ec6e9619a7 -r 
7671e4e54b2e8107679b6c343c8fcf22b843668a testing/code/test_excinfo.py
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -238,6 +238,20 @@
     else:
         assert s == "  File '<string>':1 in <module>\n  ???\n"
 
+def test_excinfo_no_python_sourcecode(tmpdir):
+    tmpdir.join('test.txt').write("{{ h()}}:")
+
+    jinja2 = py.test.importorskip('jinja2')
+    loader = jinja2.FileSystemLoader(str(tmpdir))
+    env = jinja2.Environment(loader=loader)
+    template = env.get_template('test.txt')
+    excinfo = py.test.raises(ValueError,
+                             template.render, h=h)
+    for item in excinfo.traceback:
+        print(item) #XXX: for some reason jinja.Template.render is printed in 
full
+        item.source # shouldnt fail
+
+
 def test_entrysource_Queue_example():
     try:
         queue.Queue().get(timeout=0.001)



https://bitbucket.org/hpk42/py/changeset/0121003c2f17/
changeset:   0121003c2f17
user:        RonnyPfannschmidt
date:        2011-11-23 15:11:06
summary:     add test for the decorator recursion missdetection and a testenv 
that depends on the external tools
affected #:  2 files

diff -r 7671e4e54b2e8107679b6c343c8fcf22b843668a -r 
0121003c2f17b104015309771cb18d7cd5f7927d testing/code/test_excinfo.py
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -154,6 +154,25 @@
         recindex = traceback.recursionindex()
         assert recindex is None
 
+    def test_traceback_messy_recursion(self):
+        #XXX: simplified locally testable version
+        decorator = py.test.importorskip('decorator').decorator
+        
+        def log(f, *k, **kw):
+            print('%s %s' % (k, kw))
+            f(*k, **kw)
+        log = decorator(log)
+
+        def fail():
+            raise ValueError('')
+
+        fail = log(log(fail))
+
+        excinfo = py.test.raises(ValueError, fail)
+        assert excinfo.traceback.recursionindex() is None
+
+
+
     def test_traceback_getcrashentry(self):
         def i():
             __tracebackhide__ = True
@@ -239,6 +258,7 @@
         assert s == "  File '<string>':1 in <module>\n  ???\n"
 
 def test_excinfo_no_python_sourcecode(tmpdir):
+    #XXX: simplified locally testable version
     tmpdir.join('test.txt').write("{{ h()}}:")
 
     jinja2 = py.test.importorskip('jinja2')


diff -r 7671e4e54b2e8107679b6c343c8fcf22b843668a -r 
0121003c2f17b104015309771cb18d7cd5f7927d tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -22,6 +22,14 @@
 commands=
     {envpython} -m pytest --confcutdir=.. -rfsxX 
--junitxml={envlogdir}/junit-{envname}0.xml [io_ code]
 
+[testenv:external]
+deps=
+    pytest
+    jinja2
+    decorator
+commands=
+    py.test --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}.xml 
testing/code
+
 [pytest]
 rsyncdirs = conftest.py py doc testing
 addopts = -rxXf



https://bitbucket.org/hpk42/py/changeset/be8202d2aa35/
changeset:   be8202d2aa35
user:        RonnyPfannschmidt
date:        2011-11-23 15:14:06
summary:     fix argument path in tox.ini
affected #:  1 file

diff -r 0121003c2f17b104015309771cb18d7cd5f7927d -r 
be8202d2aa3502f240e7308c7d2c15726908f072 tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -28,7 +28,7 @@
     jinja2
     decorator
 commands=
-    py.test --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}.xml 
testing/code
+    py.test --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}.xml 
{posargs:code}
 
 [pytest]
 rsyncdirs = conftest.py py doc testing



https://bitbucket.org/hpk42/py/changeset/2ffc28a9cb69/
changeset:   2ffc28a9cb69
user:        RonnyPfannschmidt
date:        2011-11-29 11:28:29
summary:     ensure tracebackitem.source returns the actual line if it cant 
find a statement range
affected #:  2 files

diff -r be8202d2aa3502f240e7308c7d2c15726908f072 -r 
2ffc28a9cb69b2ee923e1021bad577c8f8dc26db py/_code/code.py
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -169,10 +169,8 @@
         end = self.lineno
         try:
             _, end = source.getstatementrange(end)
-        except IndexError:
+        except (IndexError, ValueError):
             end = self.lineno + 1
-        except ValueError:
-            pass
         # heuristic to stop displaying source on e.g.
         #   if something:  # assume this causes a NameError
         #      # _this_ lines and the one


diff -r be8202d2aa3502f240e7308c7d2c15726908f072 -r 
2ffc28a9cb69b2ee923e1021bad577c8f8dc26db testing/code/test_excinfo.py
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -270,6 +270,8 @@
     for item in excinfo.traceback:
         print(item) #XXX: for some reason jinja.Template.render is printed in 
full
         item.source # shouldnt fail
+        if item.path.basename == 'test.txt':
+            assert str(item.source) == '{{ h()}}:'
 
 
 def test_entrysource_Queue_example():



https://bitbucket.org/hpk42/py/changeset/1166a7c0d608/
changeset:   1166a7c0d608
user:        RonnyPfannschmidt
date:        2011-11-30 18:18:14
summary:     add support for ; in iniconfig as comment starter
affected #:  3 files

diff -r 2ffc28a9cb69b2ee923e1021bad577c8f8dc26db -r 
1166a7c0d6080fe4ca0c0bd536fd7690a571e233 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
 - make trackeback recursion detection more resilent
   about the eval magic of a decorator library
 - add py.builtin.next
+- iniconfig: add support for ; as comment starter
 
 Changes between 1.4.4 and 1.4.5
 ==================================================


diff -r 2ffc28a9cb69b2ee923e1021bad577c8f8dc26db -r 
1166a7c0d6080fe4ca0c0bd536fd7690a571e233 py/_iniconfig.py
--- a/py/_iniconfig.py
+++ b/py/_iniconfig.py
@@ -103,6 +103,7 @@
     def _parseline(self, line, lineno):
         # comments
         line = line.split('#')[0].rstrip()
+        line = line.split(';')[0].rstrip()
         # blank lines
         if not line:
             return None, None


diff -r 2ffc28a9cb69b2ee923e1021bad577c8f8dc26db -r 
1166a7c0d6080fe4ca0c0bd536fd7690a571e233 testing/test_iniconfig.py
--- a/testing/test_iniconfig.py
+++ b/testing/test_iniconfig.py
@@ -65,6 +65,19 @@
         '[section] #comment',
         [(0, 'section', None, None)]
     ),
+    'comment2': (
+        '; comment',
+        []
+    ),
+    'comment2 on value': (
+        'value = 1 ; comment',
+        [(0, None, 'value', '1')]
+    ),
+
+    'comment2 on section': (
+        '[section] ;comment',
+        [(0, 'section', None, None)]
+    ),
     'pseudo section syntax in value': (
         'name = value []',
         [(0, None, 'name', 'value []')]



https://bitbucket.org/hpk42/py/changeset/bb527bc1a414/
changeset:   bb527bc1a414
user:        RonnyPfannschmidt
date:        2011-11-30 18:21:05
summary:     merge upstream
affected #:  6 files

diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,9 @@
 
 - fix issue7: source.getstatementrange() now raises proper error
   if no valid statement can be found
+- fix issue8: fix code and tests of svnurl/svnwc to work on subversion 1.7 - 
+  note that path.status(updates=1) will not properly work svn-17's status 
+  --xml output is broken.
 - make source.getstatementrange() more resilent about non-python code frames
   (as seen from jnja2)
 - make trackeback recursion detection more resilent


diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 py/__init__.py
--- a/py/__init__.py
+++ b/py/__init__.py
@@ -8,7 +8,7 @@
 
 (c) Holger Krekel and others, 2004-2010
 """
-__version__ = '1.4.6.dev1'
+__version__ = '1.4.6.dev3'
 
 from py import _apipkg
 


diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 py/_path/svnurl.py
--- a/py/_path/svnurl.py
+++ b/py/_path/svnurl.py
@@ -233,6 +233,8 @@
                 e = sys.exc_info()[1]
                 if e.err.find('non-existent in that revision') != -1:
                     raise py.error.ENOENT(self, e.err)
+                elif e.err.find("E200009:") != -1:
+                    raise py.error.ENOENT(self, e.err)
                 elif e.err.find('File not found') != -1:
                     raise py.error.ENOENT(self, e.err)
                 elif e.err.find('not part of a repository')!=-1:


diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 py/_path/svnwc.py
--- a/py/_path/svnwc.py
+++ b/py/_path/svnwc.py
@@ -482,10 +482,13 @@
         except py.process.cmdexec.Error:
             e = sys.exc_info()[1]
             strerr = e.err.lower()
-            if strerr.find('file not found') != -1:
+            if strerr.find('not found') != -1:
+                raise py.error.ENOENT(self)
+            elif strerr.find("E200009:") != -1:
                 raise py.error.ENOENT(self)
             if (strerr.find('file exists') != -1 or
                 strerr.find('file already exists') != -1 or
+                strerr.find('w150002:') != -1 or
                 strerr.find("can't create directory") != -1):
                 raise py.error.EEXIST(self)
             raise
@@ -593,7 +596,7 @@
         out = self._authsvn('lock').strip()
         if not out:
             # warning or error, raise exception
-            raise Exception(out[4:])
+            raise ValueError("unknown error in svn lock command")
 
     def unlock(self):
         """ unset a previously set lock """
@@ -1066,6 +1069,8 @@
                 modrev = '?'
                 author = '?'
                 date = ''
+            elif itemstatus == "replaced":
+                pass
             else:
                 #print entryel.toxml()
                 commitel = entryel.getElementsByTagName('commit')[0]
@@ -1148,7 +1153,11 @@
             raise  ValueError("Not a versioned resource")
             #raise ValueError, "Not a versioned resource %r" % path
         self.kind = d['nodekind'] == 'directory' and 'dir' or d['nodekind']
-        self.rev = int(d['revision'])
+        try:
+            self.rev = int(d['revision'])
+        except KeyError:
+            self.rev = None
+
         self.path = py.path.local(d['path'])
         self.size = self.path.size()
         if 'lastchangedrev' in d:


diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
         name='py',
         description='library with cross-python path, ini-parsing, io, code, 
log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.6.dev1',
+        version='1.4.6.dev3',
         url='http://pylib.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],


diff -r 1166a7c0d6080fe4ca0c0bd536fd7690a571e233 -r 
bb527bc1a4145d2531a0fb879aad610c04333605 testing/path/test_svnwc.py
--- a/testing/path/test_svnwc.py
+++ b/testing/path/test_svnwc.py
@@ -1,5 +1,6 @@
 import py
 import os, sys
+import pytest
 from py._path.svnwc import InfoSvnWCCommand, XMLWCStatus, parse_wcinfotime
 from py._path import svnwc as svncommon
 from svntestbase import CommonSvnTests
@@ -105,6 +106,7 @@
         assert r.join('sampledir/otherfile').basename in [item.basename
                                                     for item in s.unchanged]
 
+    @pytest.mark.xfail(reason="svn-1.7 has buggy 'status --xml' output")
     def test_status_update(self, path1):
         r = path1
         try:
@@ -112,6 +114,7 @@
             s = r.status(updates=1, rec=1)
             # Comparing just the file names, because paths are unpredictable
             # on Windows. (long vs. 8.3 paths)
+            py.std.pprint.pprint(s.allpath())
             assert r.join('anotherfile').basename in [item.basename for
                                                     item in s.update_available]
             #assert len(s.update_available) == 1
@@ -122,7 +125,6 @@
         p = path1.join("samplefile")
         p.remove()
         p.ensure(dir=0)
-        p.add()
         try:
             s = path1.status()
             assert p.basename in [item.basename for item in s.replaced]
@@ -164,8 +166,6 @@
         otherrepo, otherrepourl, otherwc = repowc2
         d = path1.ensure('sampledir', dir=1)
         try:
-            d.remove()
-            d.add()
             d.update()
             d.propset('svn:externals', 'otherwc %s' % (otherwc.url,))
             d.update()
@@ -181,7 +181,7 @@
     def test_status_deleted(self, path1):
         d = path1.ensure('sampledir', dir=1)
         d.remove()
-        d.add()
+        d.ensure(dir=1)
         path1.commit()
         d.ensure('deletefile', dir=0)
         d.commit()
@@ -338,7 +338,7 @@
         somefile = root.join('somefile')
         somefile.ensure(file=True)
         # not yet added to repo
-        py.test.raises(py.process.cmdexec.Error, 'somefile.lock()')
+        py.test.raises((py.process.cmdexec.Error, ValueError), 
'somefile.lock()')
         somefile.write('foo')
         somefile.commit('test')
         assert somefile.check(versioned=True)

Repository URL: https://bitbucket.org/hpk42/py/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to