From ondrej at certik.cz Wed Aug 9 21:31:43 2006 From: ondrej at certik.cz (Ondrej Certik) Date: Wed, 9 Aug 2006 15:31:43 -0400 Subject: [py-dev] py.execnet example bug Message-ID: <85b5c3130608091231h1ab96147g2296a2130bc4229f@mail.gmail.com> Hi, I tried this example: http://codespeak.net/py/current/doc/execnet.html#a-simple-and-useful-example-for-channels and it seems it doesn't work for me - I had to change this: for fn in channel.receive(): f = open(fn, 'rb') try: channel.send(f.read()) finally: f.close() to this: try: while 1: fn=channel.receive() f = open(fn, 'rb') try: channel.send(f.read()) finally: f.close() except: pass to make it work. The problem is, that channel.receive() returns a string (a filename), and the for loop then iterates over the characters of the filename, which is obviously not what was intended. Am I doing something wrong, or is it a bug? Ondrej From hpk at trillke.net Thu Aug 10 07:11:14 2006 From: hpk at trillke.net (holger krekel) Date: Thu, 10 Aug 2006 07:11:14 +0200 Subject: [py-dev] py.execnet example bug In-Reply-To: <85b5c3130608091231h1ab96147g2296a2130bc4229f@mail.gmail.com> References: <85b5c3130608091231h1ab96147g2296a2130bc4229f@mail.gmail.com> Message-ID: <20060810051114.GT22199@solar.trillke.net> Hi Ondrej, On Wed, Aug 09, 2006 at 15:31 -0400, Ondrej Certik wrote: > Hi, I tried this example: > > http://codespeak.net/py/current/doc/execnet.html#a-simple-and-useful-example-for-channels > > and it seems it doesn't work for me - > > I had to change this: > > for fn in channel.receive(): > f = open(fn, 'rb') > try: > channel.send(f.read()) > finally: > f.close() > > to this: > > try: > while 1: > fn=channel.receive() > f = open(fn, 'rb') > try: > channel.send(f.read()) > finally: > f.close() > except: > pass > > to make it work. The problem is, that channel.receive() returns a > string (a filename), and the for loop then iterates over the > characters of the filename, which is obviously not what was intended. > Am I doing something wrong, or is it a bug? The original intention was: for fn in channel: # no .receive() here ... was the original intention and it should work (the iteration over a channel will raise StopIteration when the other side closes it). I fixed the example. Your replacement above is fine, but the "error" handling is a bit rough: just swallowing all exceptions makes it somewhat hard to detect for the other side to notice (and make sense out of) the error. It's probably better to have a "try:except:" within the for-loop block and send back a tuple encoding error information. (You cannot send "user" objects, only marshallable objects, i.e. dicts, tuples, lists, of strings/ints/dicts/tuples/lists...) best and HTH, holger From ondrej at certik.cz Thu Aug 10 16:04:24 2006 From: ondrej at certik.cz (Ondrej Certik) Date: Thu, 10 Aug 2006 10:04:24 -0400 Subject: [py-dev] py.execnet example bug In-Reply-To: <20060810051114.GT22199@solar.trillke.net> References: <85b5c3130608091231h1ab96147g2296a2130bc4229f@mail.gmail.com> <20060810051114.GT22199@solar.trillke.net> Message-ID: <85b5c3130608100704h599e3df3o96488b0f070a82cc@mail.gmail.com> > Your replacement above is fine, but the "error" handling > is a bit rough: just swallowing all exceptions makes it > somewhat hard to detect for the other side to notice > (and make sense out of) the error. It's probably better to > have a "try:except:" within the for-loop block and send > back a tuple encoding error information. (You cannot send > "user" objects, only marshallable objects, i.e. dicts, tuples, > lists, of strings/ints/dicts/tuples/lists...) Thanks. Yes, it was just a rough quickfix to make it work somehow. Ondrej From hpk at trillke.net Tue Aug 29 07:59:15 2006 From: hpk at trillke.net (holger krekel) Date: Tue, 29 Aug 2006 07:59:15 +0200 Subject: [py-dev] merging new distributed testing approach Message-ID: <20060829055915.GY21969@solar.trillke.net> Hi folks, Maciej Fijalkowski (as part of his Summer of PyPy involvement) and me nicely sprinted in Ireland a couple of days on evolving py.test to perform ad-hoc distributed testing. The work is living in this branch https://codespeak.net/svn/py/branch/distributed and incorporates a partial rewrite of the session and reporting logic. With "py.test --session=R" the new py/test/resssion/rsession.py's RSession will come into play and distribute tests to a number of ssh-address specified hosts. The ssh-hosts need to be specified in a conftest.py with "disthosts=['sshaddress1', 'sshaddress2', ...]" The new session object does not implement all the TerminalSession's options yet. As only a few refactorings/refinements were needed in the rest of the py lib, and the current py.test logic continues to be in effect by default, Maciej and me intend to merge the branch this week to simplify development and have more early users. If you notice any behaviour regressions for the still non-distributed py.test default running, please notify here on the list or on the issue tracker. It then remains to be seen when/how we declare the non-distributed case a special case of the distributed one. best, holger -- merlinux GmbH Steinbergstr. 42 31139 Hildesheim http://merlinux.de tel +49 5121 20800 75 (fax 77) From alex.j.ross at gmail.com Wed Aug 30 03:10:22 2006 From: alex.j.ross at gmail.com (Alexander Ross) Date: Tue, 29 Aug 2006 18:10:22 -0700 Subject: [py-dev] Patch to py/path/local/common.py Message-ID: Compiling the file `py/path/local/common.py` with python2.2 results in a SyntaxError. This keeps `py.test --exec=python2.2` from running as advertised. I was able to patch `py/path/local/common.py` so that it will work with python2.2. I don't know if this breaks anything, but it has worked for me so far. Index: py/path/local/common.py =================================================================== --- py/path/local/common.py (revision 31816) +++ py/path/local/common.py (working copy) @@ -5,18 +5,17 @@ self.path = path self._osstatresult = osstatresult - for name in ('atime blksize blocks ctime dev gid ' + for name in ('atime blksize blocks ctime dev gid ' 'ino mode mtime nlink rdev size uid'.split()): - exec """if 1: - def fget(self): - return getattr(self._osstatresult, "st_%(name)s", None) - %(name)s = property(fget) - def fget_deprecated(self): - py.std.warnings.warn("statresult.st_%(name)s is deprecated, use " - "statresult.%(name)s instead.", - DeprecationWarning, stacklevel=2) - return getattr(self._osstatresult, "st_%(name)s", None) - st_%(name)s = property(fget_deprecated)""" % locals() + exec """def fget(self): + return getattr(self._osstatresult, "st_%(name)s", None) +%(name)s = property(fget) +def fget_deprecated(self): + py.std.warnings.warn("statresult.st_%(name)s is deprecated, use " + "statresult.%(name)s instead.", + DeprecationWarning, stacklevel=2) + return getattr(self._osstatresult, "st_%(name)s", None) +st_%(name)s = property(fget_deprecated)""" % locals() del fget del fget_deprecated