homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients Arfrever, brett.cannon, eli.bendersky, eric.snow, ezio.melotti, pitrou
Date 2013年01月28日.14:51:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359384711.26.0.999962935747.issue17037@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013年01月28日 14:51:51brett.cannonsetrecipients: + brett.cannon, pitrou, ezio.melotti, Arfrever, eli.bendersky, eric.snow
2013年01月28日 14:51:51brett.cannonsetmessageid: <1359384711.26.0.999962935747.issue17037@psf.upfronthosting.co.za>
2013年01月28日 14:51:51brett.cannonlinkissue17037 messages
2013年01月28日 14:51:50brett.cannoncreate

AltStyle によって変換されたページ (->オリジナル) /