I generated and imported a module that contains a test that I want to run with nose2
. Here is the code that creates and import the module:
import sys
import imp
import nose2
def import_code(code, name):
module = imp.new_module(name)
exec code in module.__dict__
sys.modules[name] = module
return module
code_to_test = ("""
def test_foo():
print "hello test_foo"
""")
module_to_test = import_code(code_to_test, 'moduletotest')
# now how can I tell nose2 to run the test?
Aucun commentaire:
Enregistrer un commentaire