Author brett.cannon
Recipients amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, daniel.urban, lemburg, mark.dickinson, pitrou, r.david.murray, techtonik, vstinner
Date 2010-06-17.18:54:05
SpamBayes Score 6.39399e-05
Marked as misclassified No
Message-id <1276800847.88.0.609071962306.issue7989@psf.upfronthosting.co.za>
In-reply-to
Content
A couple of things about all of this.

One, we should not blindly pull in the PyPy code without some core PyPy developer being in on this; just common courtesy and I don't think anyone participating in this discussion is a PyPy developer (but I could be wrong).

Two, as David pointed out, parsing overhead is pretty minor thing to be worrying about thanks to bytecode. The import * solution at the end of the main file is the agreed-upon approach (it has been discussed at some point).

Three, for testing you can also look at test_warnings (the creation of _warnings led to the discussion of best practices for all of this). Basically you use test.support.import_fresh_module to get the pure Python version and the C-enhanced one, write your tests with the module being tested set on the class, and then subclass with the proper modules as a class attribute. I understand your worry, Alexander, about accidentally missing a test class for a module, but in practice that will be rare as people will be watching for that, and you just do the subclass first. There is in practice no need to get too fancy, and you have to make sure your tests are discoverable anyway by test runners that simply look for classes that inherit from unittest.TestCase.

Best alternative you could do is a metaclass that searches for tests that start with 'test' *and* take an argument for the module to test, and then auto-create methods that take *no* arguments and then call the test methods directly (after renaming them so that test runners don't try to use them). Then you can pass in the modules to test as arguments to the metaclass.
History
Date User Action Args
2010-06-17 18:54:17brett.cannonsetrecipients: + brett.cannon, lemburg, amaury.forgeotdarc, mark.dickinson, belopolsky, pitrou, vstinner, techtonik, r.david.murray, brian.curtin, daniel.urban
2010-06-17 18:54:07brett.cannonsetmessageid: <1276800847.88.0.609071962306.issue7989@psf.upfronthosting.co.za>
2010-06-17 18:54:06brett.cannonlinkissue7989 messages
2010-06-17 18:54:05brett.cannoncreate