![](https://secure.gravatar.com/avatar/eedc6324dbdf7c194c215ad09f7548ad.jpg?s=120&d=mm&r=g)
Using --tb=short has propably always crashed (with a failing test). Attached is a file demonstrating a few issues with pypys applevel testing framework, of which some might be 'won't fix' Elmo
![](https://secure.gravatar.com/avatar/eedc6324dbdf7c194c215ad09f7548ad.jpg?s=120&d=mm&r=g)
Of course, now I py.test behaves with --tb=short, might have been my fault after all:). Apparently, all of the stuff below but the first aren't bugs. Elmo Elmo Mäntynen wrote:
Using --tb=short has propably always crashed (with a failing test).
Attached is a file demonstrating a few issues with pypys applevel testing framework, of which some might be 'won't fix'
Elmo
------------------------------------------------------------------------
from pypy.conftest import gettestobjspace
class BaseAppTestInheritance: def setup_class(cls): pass
def test_foo(self): pass
class AppTest(BaseAppTestInheritance): def setup_class(cls): BaseAppTestInheritance.setup_class(cls)
#Demonstrates the workaround I had to use instead of the former way: class BaseAppTestWorkaround: def setup_class(cls): self._setup_class(cls)
@staticmethod def _setup_class(cls): pass
def test_foo(self): pass
class AppTestWorkaround(BaseAppTestWorkaround): def setup_class(cls): BaseAppTestWorkaround._setup_class(cls)
#Should this work? I don't specifically need this 'cause I found a better way... class AppTestFoo: def setup_class(cls): cls.space = gettestobjspace() cls.w_func = cls.space.appexec([cls.space.wrap(cls)], """(cls): def f(): print cls.var return f """) cls.w_var='foo'
def test_foo(self): self.func()
class AppTestBar: def setup_class(cls): cls.space = gettestobjspace() cls.w_func = cls.space.appexec((), """(): import py.test def f(): py.test.skip() return f """)
def test_foo(self): self.func()
------------------------------------------------------------------------
_______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
![](https://secure.gravatar.com/avatar/2c1bbda1fbfa050465bc2a4448866c09.jpg?s=120&d=mm&r=g)
Elmo Mäntynen wrote: <snip> Solution to the first problem: class BaseAppTestInheritance: def setup_class(cls): pass def test_foo(self): pass class AppTest(BaseAppTestInheritance): def setup_class(cls): BaseAppTestInheritance.setup_class.im_func(cls) (im_func is here a trick). That's python fault/feature in my opinion. Cheers, fijal :.
![](https://secure.gravatar.com/avatar/eedc6324dbdf7c194c215ad09f7548ad.jpg?s=120&d=mm&r=g)
Now I got that traceback I have gotten so many times: Traceback (most recent call last): File "/home/drayko/Workfolder/Security/Python/cvs/py-dist/py/bin/py.test", line 4, in ? py.test.cmdline.main() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/cmdline.py", line 15, in main failures = session.main() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/session.py", line 67, in main self.footer(colitems) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 167, in footer self.failures() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 262, in failures self.repr_failure(colitem, outcome) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 280, in repr_failure handler(item, excinfo, traceback, lambda : self.repr_out_err(item)) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/representation.py", line 146, in repr_failure_tbshort self.out.line(' File "%s", line %d, in %s' % ( File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/code/traceback2.py", line 94, in name return self.frame.code.raw.co_name AttributeError: 'str' object has no attribute 'co_name' Elmo Mäntynen wrote:
Of course, now I py.test behaves with --tb=short, might have been my fault after all:).
Apparently, all of the stuff below but the first aren't bugs.
Elmo
Elmo Mäntynen wrote:
Using --tb=short has propably always crashed (with a failing test).
...
![](https://secure.gravatar.com/avatar/eedc6324dbdf7c194c215ad09f7548ad.jpg?s=120&d=mm&r=g)
I get the crash if the first test in a bunch fails. Elmo Mäntynen wrote:
Now I got that traceback I have gotten so many times:
Traceback (most recent call last): File "/home/drayko/Workfolder/Security/Python/cvs/py-dist/py/bin/py.test", line 4, in ? py.test.cmdline.main() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/cmdline.py", line 15, in main failures = session.main() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/session.py", line 67, in main self.footer(colitems) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 167, in footer self.failures() File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 262, in failures self.repr_failure(colitem, outcome) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/terminal/terminal.py", line 280, in repr_failure handler(item, excinfo, traceback, lambda : self.repr_out_err(item)) File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/test/representation.py", line 146, in repr_failure_tbshort self.out.line(' File "%s", line %d, in %s' % ( File "/home/drayko/Workfolder/Security/Python/pypy/pypy-dist2/py/code/traceback2.py", line 94, in name return self.frame.code.raw.co_name AttributeError: 'str' object has no attribute 'co_name'
Elmo Mäntynen wrote:
Of course, now I py.test behaves with --tb=short, might have been my fault after all:).
Apparently, all of the stuff below but the first aren't bugs.
Elmo
Elmo Mäntynen wrote:
Using --tb=short has propably always crashed (with a failing test).
...
![](https://secure.gravatar.com/avatar/5b37e6b4ac97453e4ba9dba37954cf79.jpg?s=120&d=mm&r=g)
Hi Elmo, Indeed, it seems that we didn't try --tb=short with app-level tests. It crashes for me too. Not sure I want to investigate as it seems that nobody used --tb=short enough to notice so far... It works fine on interp-level tests. Armin
![](https://secure.gravatar.com/avatar/2c1bbda1fbfa050465bc2a4448866c09.jpg?s=120&d=mm&r=g)
Armin Rigo wrote:
Hi Elmo,
Indeed, it seems that we didn't try --tb=short with app-level tests. It crashes for me too. Not sure I want to investigate as it seems that nobody used --tb=short enough to notice so far... It works fine on interp-level tests.
Armin _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
:.
Might be worth noticing. I'm trying to refactor py.test on a huge scale. This means that few things will change in API when subclassing Session, hence applevel tests would need some refactorings as well (probably not too much, but still). This might solve the problem as a side effect. :.
![](https://secure.gravatar.com/avatar/7ed9784cbb1ba1ef75454034b3a8e6a1.jpg?s=120&d=mm&r=g)
On Sun, 21 Oct 2007 13:08:31 +0200, Armin Rigo <arigo@tunes.org> wrote:
Hi Elmo,
Indeed, it seems that we didn't try --tb=short with app-level tests. It crashes for me too. Not sure I want to investigate as it seems that nobody used --tb=short enough to notice so far... It works fine on interp-level tests.
fwiw, I noticed :P Jean-Paul
participants (4)
-
Armin Rigo
-
Elmo Mäntynen
-
Jean-Paul Calderone
-
Maciek Fijalkowski