Message180859
True, the current idiom needs to still be used in those cases, although we could introduce another method to help with this situation as well:
# Could also be named use_accelerator to be less hostile-sounding.
def requires_accelerator(self, cls):
if self.accelerated_module is None:
raise SkipTest # With proper message
else:
setattr(cls, self.module_name, self.accelerated_module)
return cls
Then the idiom becomes:
@pep399_tests.requires_accelerator
class AcceleratorSpecificTests(unittest.TestCase): pass
This then extends out to also the current idiom if you don't want to have any "magical" classes:
@pep399_tests.requires_accelerator
class AcceleratedExampleTests(unittest.TestCase): pass
# Can add another decorator for this if desired.
class PyExampleTests(unittest.TestCase):
module = pep399_tests.py_module
This also has the benefit of extracting out the module attribute name to minimize messing even that up. |
|
Date |
User |
Action |
Args |
2013-01-28 14:51:51 | brett.cannon | set | recipients:
+ brett.cannon, pitrou, ezio.melotti, Arfrever, eli.bendersky, eric.snow |
2013-01-28 14:51:51 | brett.cannon | set | messageid: <1359384711.26.0.999962935747.issue17037@psf.upfronthosting.co.za> |
2013-01-28 14:51:51 | brett.cannon | link | issue17037 messages |
2013-01-28 14:51:50 | brett.cannon | create | |
|