Exemplo n.º 1
0
 def find_test_modules(self,pattern):
    # Find all the unittests that match a given string pattern
     modules= []
     for path, dirs, files in os.walk("test"):
         for filename in fnmatch.filter(files, pattern):
             #add the test directories to the path
             sys.path.append(os.path.join(path))
             #save the module name for importing
             modules.append(fullmodname(filename))
     return modules
Exemplo n.º 2
0
 def find_test_modules(self, pattern):
     # Find all the unittests that match a given string pattern
     modules = []
     for path, dirs, files in os.walk("test"):
         for filename in fnmatch.filter(files, pattern):
             #add the test directories to the path
             sys.path.append(os.path.join(path))
             #save the module name for importing
             modules.append(fullmodname(filename))
     return modules
Exemplo n.º 3
0
 def test_issue9936(self):
     tracer = trace.Trace(trace=0, count=1)
     modname = 'test.tracedmodules.testmod'
     # Ensure that the module is executed in import
     if modname in sys.modules:
         del sys.modules[modname]
     cmd = ("import test.tracedmodules.testmod as t;"
            "t.func(0); t.func2();")
     with captured_stdout() as stdout:
         self._coverage(tracer, cmd)
     stdout.seek(0)
     stdout.readline()
     coverage = {}
     for line in stdout:
         lines, cov, module = line.split()[:3]
         coverage[module] = (int(lines), int(cov[:-1]))
     # XXX This is needed to run regrtest.py as a script
     modname = trace.fullmodname(sys.modules[modname].__file__)
     self.assertIn(modname, coverage)
     self.assertEqual(coverage[modname], (5, 100))
Exemplo n.º 4
0
 def test_issue9936(self):
     tracer = trace.Trace(trace=0, count=1)
     modname = 'test.tracedmodules.testmod'
     # Ensure that the module is executed in import
     if modname in sys.modules:
         del sys.modules[modname]
     cmd = ("import test.tracedmodules.testmod as t;"
            "t.func(0); t.func2();")
     with captured_stdout() as stdout:
         self._coverage(tracer, cmd)
     stdout.seek(0)
     stdout.readline()
     coverage = {}
     for line in stdout:
         lines, cov, module = line.split()[:3]
         coverage[module] = (int(lines), int(cov[:-1]))
     # XXX This is needed to run regrtest.py as a script
     modname = trace.fullmodname(sys.modules[modname].__file__)
     self.assertIn(modname, coverage)
     self.assertEqual(coverage[modname], (5, 100))
Exemplo n.º 5
0
 def test_deprecated_fullmodname(self):
     with self.assertWarns(DeprecationWarning):
         self.assertEqual("spam", trace.fullmodname("spam"))
Exemplo n.º 6
0
 def test_deprecated_fullmodname(self):
     with self.assertWarns(DeprecationWarning):
         self.assertEqual("spam", trace.fullmodname("spam"))