On Apr 28, 2012, at 5:32 PM, Benjamin Peterson wrote: > 2012/4/28 Timo Paulssen <t...@wakelift.de>: >> Hello there, >> >> I was writing a few test cases for numpypy to make sure it behaves like >> numpy does when confronted with objects that have either an __int__, an >> __index__ or both (rule of thumb: index is prefered, but int is accepted in >> absence of index). >> >> Now, I wrote six tests that use three custom objects (one set for getitem, >> one set for setitem and one test each for int only, int and index and index >> only). >> >> I couldn't put those classes outside the applevel test (this is about >> pypy/module/micronumpy/test/test_numarray.py btw) because there's some kind >> of separation going on there. I *thought* the way to do it was to put it >> inside the applevel test class and have its name start with w_, but that >> wasn't it either. > > Yes, this only works for functions. You probably want to use > space.appexec in setup_class().
You can just make a w_ function that returns the class (better than an appexec blob). E.g. see get_MockRawIO in test_textio: https://bitbucket.org/pypy/pypy/src/55deb3442c05/pypy/module/_io/test/test_textio.py#cl-213 -- Philip Jenvey _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev