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 belopolsky
Recipients amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, daniel.urban, lemburg, pitrou, r.david.murray, techtonik, vstinner
Date 2010-06-17.15:35:10
SpamBayes Score 0.0294443
Marked as misclassified No
Message-id <>
> The only alternative is to manually duplicate tests, these leads to very
> poor test coverage because of the average developer's laziness (json is
> an example).

No, here is another alternative:

==> <==
def foo():

==> <==
def foo():
    from _example import *
except ImportError:

==> <==
import sys
sys.modules['_example'] = None
import example
del sys.modules['_example']
import _example as example

With the code above,

$ ./python.exe

If we move import to setUp(), we can run each test case twice: with and without native code.  Tests that are specific to one implementation can be run once or skipped conditionally on per test method basis.
Date User Action Args
2010-06-17 15:35:12belopolskysetrecipients: + belopolsky, lemburg, brett.cannon, amaury.forgeotdarc, pitrou, vstinner, techtonik, r.david.murray, brian.curtin, daniel.urban
2010-06-17 15:35:12belopolskysetmessageid: <>
2010-06-17 15:35:10belopolskylinkissue7989 messages
2010-06-17 15:35:10belopolskycreate