Example #1
0
def local_tests():
        print "local tests.."

        checkl("testfun1", modutil.find_modules([testfun1]),\
                ["random", "os", "time"])

        checkl("testfun2", modutil.find_modules([testfun2]),\
                [('extramodule1', abspath("extramodule1.py"))])

        checkl("testfun1+2", modutil.find_modules([testfun1, testfun2],\
                send_modules = False),\
                        ["random", "os", "time", "extramodule1"])

        try:
                modutil.find_modules([testfun3])
                raise Exception("Test testfun3 failed: No exception raised")
        except ImportError:
                pass

        checkl("testfun4", modutil.find_modules([testfun4]),\
                [("mod1", abspath("extra/mod1.py")),\
                 ("mod2", abspath("extra/mod2.py"))])

        checkl("testfun4-nosend", modutil.find_modules([testfun4],\
                send_modules = False), ["mod1"])

        checkl("testfun4-norecurse", modutil.find_modules([testfun4],\
                recurse = False), [("mod1", abspath("extra/mod1.py"))])

        print "local tests ok"
Example #2
0
 def required_modules(self):
     return modutil.find_modules([self.map])
Example #3
0
 def test_missing(self):
     self.assertRaises(ModUtilImportError, lambda: modutil.find_modules([missing_module]))
Example #4
0
 def assertFindsModules(self, functions, modules, send_modules=True, recurse=True):
     self.assertEquals(sorted(modutil.find_modules(functions,
                               send_modules=send_modules,
                               recurse=recurse)),
               sorted(modules))
Example #5
0
print "disco tests.."

# default
job = disco.new_job(
        name = "test_modutil1",
        input = tserver.makeurl(inputs),
        map = fun_map)
checkl("test_modutil1", result_iterator(job.wait()), [("4.0", "")])
job.purge()
print "test_modutil1 ok"

job = disco.new_job(
        name = "test_modutil2",
        input = tserver.makeurl(inputs),
        required_modules = modutil.find_modules([fun_map]),
        map = fun_map)
checkl("test_modutil2", result_iterator(job.wait()), [("4.0", "")])
job.purge()
print "test_modutil2 ok"

job = disco.new_job(
        name = "test_modutil3",
        input = tserver.makeurl(inputs),
        required_modules = ["math", ("mod1", "extra/mod1.py")],
        required_files = [modutil.locate_modules(["mod2"])[0][1]],
        map = fun_map)
checkl("test_modutil3", result_iterator(job.wait()), [("4.0", "")])
job.purge()
print "test_modutil3 ok"