예제 #1
0
파일: Test.py 프로젝트: stevegt/isconf4
    def doctest(self):
        import doctest, coverage
        # (f,t) = doctest.testmod(eval('isconf.Kernel'))
        # doctest.master.summarize()
        # sys.exit(f)

        modules = []
        olddir = os.getcwd()
        os.chdir('lib/python')
        os.path.walk('.',getmods,modules)
        os.chdir(olddir)
        print modules
        
        # modules=[rpc822]

        fail=0
        total=0
        coverage.erase()
        coverage.start()
        for mod in modules:
            (f,t) = doctest.testmod(mod,report=0)
            fail += f
            total += t
        doctest.master.summarize()
        coverage.stop()
        for mod in modules:
            coverage.analysis(mod)
        coverage.report(modules)
        sys.exit(fail)
예제 #2
0
def doit():
    srcdir = os.environ['RTTSrcDir']
    pyfiles = glob.glob(os.path.join(srcdir, '*.py'))

    coverage.erase()
    coverage.start()

    run.TestFramework()

    coverage.stop()
    coverage.analysis(run)

    coverage.report(pyfiles)

    coverage.erase()
예제 #3
0
    def run_tests(self, test_labels, verbosity=1, interactive=True, extra_tests=[]):
        coveragemodules = getattr(settings, 'COVERAGE_MODULES', [])

        if coveragemodules:
            coverage.start()

        self.setup_test_environment()

        suite = self.build_suite(test_labels, extra_tests)
        old_config = self.setup_databases()
        result = self.run_suite(suite)

        if coveragemodules:
            coverage.stop()
            coveragedir = getattr(settings, 'COVERAGE_DIR', './build/coverage')
            if not os.path.exists(coveragedir):
                os.makedirs(coveragedir)

            modules = []
            for module_string in coveragemodules:
                module = __import__(module_string, globals(), locals(), [""])
                modules.append(module)
                f,s,m,mf = coverage.analysis(module)
                fp = file(os.path.join(coveragedir, module_string + ".html"), "wb")
                colorize.colorize_file(f, outstream=fp, not_covered=mf)
                fp.close()
            coverage.report(modules, show_missing=0)
            coverage.erase()

        self.teardown_databases(old_config)
        self.teardown_test_environment()

        return len(result.failures) + len(result.errors)
예제 #4
0
def writeCoverage(module, oldBase, newBase):
    filename, numbers, unexecuted, s = coverage.analysis(module)
    coverFilename = filename + ',cover'
    if coverFilename.startswith(oldBase):
        coverFilename = newBase + coverFilename[len(oldBase):]
    fout = open(coverFilename, 'w')
    fin = open(filename)
    i = 1
    lines = 0
    good = 0
    while 1:
        line = fin.readline()
        if not line: break
        assert line[-1] == '\n'
        fout.write(line[:-1])
        unused = i in unexecuted
        interesting = interestingLine(line, unused)
        if interesting:
            if unused:
                fout.write(' '*(72-len(line)))
                fout.write('#@@@@')
                lastUnused = True
            else:
                lastUnused = False
                good += 1
            lines += 1
        fout.write('\n')
        i += 1
    fout.write('\n# Coverage:\n')
    fout.write('# %i/%i, %i%%' % (
        good, lines, lines and int(good*100/lines)))
    fout.close()
    fin.close()
예제 #5
0
def nose_start(LOG, REPO_PATH):  # test names
    """
    Find all python modules in REPO_PATH
    """
    WORKING_DIR = getcwd()
    chdir(REPO_PATH)
    coverage.erase()
    coverage.start()
    nose.run()
    coverage.stop()
    LOG.info(coverage.analysis(nose))
    LOG.info(coverage.report())
    chdir(WORKING_DIR)
예제 #6
0
def runTests(testModules=None, profileOut=None, coverageOutDir=None):
    if coverageOutDir is not None:
        if not os.path.exists(coverageOutDir):
            os.makedirs(coverageOutDir)
        coverage.erase()
        coverage.start()

    alltests = unittest.TestLoader().loadTestsFromNames(testModules)

    if profileOut is not None:
        results = Profiler().profile(alltests)
        results.sort()
        results.reverse()
        out = open(profileOut, 'w')
        for result in results:
            out.write("%s  \t%3.6f\n" % (result[1], result[0]))
        print "unittest profiling information written in " + profileOut
        out.close()
    else:
        # if we don't add this else the tests are run twice
        unittest.TextTestRunner().run(alltests)

    if coverageOutDir is not None:
        coverage.stop()
        modules = glob('../*.py')
        #modules.remove('../__init__.py')

        for module in modules:
            f, s, m, mf = coverage.analysis(module)
            out = file(join(coverageOutDir,
                            os.path.basename(f) + '.html'), 'wb')
            colorize.colorize_file(f, outstream=out, not_covered=mf)
            out.close()
        print
        coverageReportTxt = file(join(coverageOutDir, "coverage.txt"), 'w')
        coverage.report(modules,
                        show_missing=False,
                        omit_prefixes=['__'],
                        file=coverageReportTxt)
        coverageReportTxt.close()
        coverage.report(modules, show_missing=False, omit_prefixes=['__'])
        coverage.erase()

        coverageReportTxt.close()
        print
        print "Coverage information updated in " + coverageOutDir
        print

        import webbrowser
        webbrowser.open('file://' + join(getcwd(), coverageOutDir))
예제 #7
0
파일: test.py 프로젝트: PaulRudin/xappy
def get_coverage(modules, covered_lines):
    topdir = get_topdir()
    import coverage

    # Compile the expressions in COVERED_LINES
    covered_lines = [(lines, re.compile(pattern))
                     for (lines, pattern) in covered_lines]

    # Get the coverage statistics
    stats = []
    for module in modules:
        (filename, stmtlines, stmtmissed, stmtmissed_desc) = coverage.analysis(module)
        filename = canonical_path(filename)
        if filename.startswith(topdir):
            filename = filename[len(topdir) + 1:]

        lines = open(filename).readlines()
        linenum = len(lines)

        # Remove whitelisted lines
        stmtmissed = [linenum for linenum in stmtmissed
                      if not check_whitelist(lines, linenum, covered_lines)]

        # Sort the lines (probably already in order, but let's double-check)
        stmtlines.sort()
        stmtmissed.sort()

        # Build a compressed list of ranges of lines which have no statements
        # which were executed, but do contain statements.
        missed_ranges = []
        stmtpos = 0
        currrange = None
        for linenum in stmtmissed:
            while stmtlines[stmtpos] < linenum:
                # If there are any statements before the current linenum, we
                # end the current range of missed statements
                currrange = None
                stmtpos += 1
            if currrange is None:
                currrange = [linenum, linenum]
                missed_ranges.append(currrange)
            else:
                currrange[1] = linenum
            stmtpos += 1

        percent = (len(stmtlines) - len(stmtmissed)) * 100.0 / len(stmtlines)
        stats.append((filename, percent, len(stmtlines), missed_ranges))
    return stats
예제 #8
0
def my_run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
    """
    Run the unit tests for all the test labels in the provided list.
    Labels must be of the form:
     - app.TestClass.test_method
        Run a single specific test method
     - app.TestClass
        Run all the test methods in a given class
     - app
        Search for doctests and unittests in the named application.

    When looking for tests, the test runner will look in the models and
    tests modules for the application.

    A list of 'extra' tests may also be provided; these tests
    will be added to the test suite.

    Returns the number of tests that failed.
    """
    coveragemodules = []
    if hasattr(settings, 'COVERAGE_MODULES'):
        coveragemodules = settings.COVERAGE_MODULES
    if coveragemodules:
        coverage.start()

    result = run_tests(test_labels, verbosity, interactive, extra_tests)

    if coveragemodules:
        coverage.stop()
        coveragedir = './build/coverage'
        if hasattr(settings, 'COVERAGE_DIR'):
            coveragedir = settings.COVERAGE_DIR
        if not os.path.exists(coveragedir):
            os.makedirs(coveragedir)
        modules = []
        for module_string in coveragemodules:
            module = __import__(module_string, globals(), locals(), [""])
            modules.append(module)
            f,s,m,mf = coverage.analysis(module)
            fp = file(os.path.join(coveragedir, module_string + ".html"), "wb")
            coverage_color.colorize_file(f, outstream=fp, not_covered=mf)
            fp.close()
        coverage.the_coverage.report(modules, show_missing=1)
        coverage.erase()

    return result
예제 #9
0
파일: test.py 프로젝트: Letractively/pytof
def runTests(testModules=None, profileOut=None, coverageOutDir=None):
    if coverageOutDir is not None:
        if not os.path.exists(coverageOutDir):
            os.makedirs(coverageOutDir)
        coverage.erase()
        coverage.start()
        
    alltests = unittest.TestLoader().loadTestsFromNames(testModules)
    
    if profileOut is not None:
        results = Profiler().profile(alltests)
        results.sort()
        results.reverse()
        out = open(profileOut, 'w')
        for result in results:
            out.write("%s  \t%3.6f\n" % (result[1], result[0]))
        print "unittest profiling information written in " + profileOut
        out.close()
    else:
        # if we don't add this else the tests are run twice
        unittest.TextTestRunner().run(alltests)

    if coverageOutDir is not None:
        coverage.stop()
        modules = glob('../pytof/*.py')
        modules.remove('../pytof/__init__.py')
                
        for module in modules:
            f, s, m, mf = coverage.analysis(module)
            out = file(join(coverageOutDir, os.path.basename(f)+'.html'), 'wb')
            colorize.colorize_file(f, outstream=out, not_covered=mf)
            out.close()
        print
        coverageReportTxt = file(join(coverageOutDir, "coverage.txt"), 'w')
        coverage.report(modules, show_missing=False, omit_prefixes=['__'], file=coverageReportTxt) 
        coverageReportTxt.close()
        coverage.report(modules, show_missing=False, omit_prefixes=['__'])
        coverage.erase()
        
        coverageReportTxt.close()
        print
        print "Coverage information updated in " + coverageOutDir
        print

        import webbrowser
        webbrowser.open('file://' + join(getcwd(), coverageOutDir))
예제 #10
0
    def test_simple(self):
        coverage.erase()

        self.make_file("mycode.py", """\
            a = 1
            b = 2
            if b == 3:
                c = 4
            d = 5
            """)

        # Import the Python file, executing it.
        self.start_import_stop(coverage, "mycode")

        _, statements, missing, missingtext = coverage.analysis("mycode.py")
        self.assertEqual(statements, [1,2,3,4,5])
        self.assertEqual(missing, [4])
        self.assertEqual(missingtext, "4")
예제 #11
0
    def test_simple(self):
        coverage.erase()

        self.make_file(
            "mycode.py", """\
            a = 1
            b = 2
            if b == 3:
                c = 4
            d = 5
            """)

        # Import the Python file, executing it.
        self.start_import_stop(coverage, "mycode")

        _, statements, missing, missingtext = coverage.analysis("mycode.py")
        self.assertEqual(statements, [1, 2, 3, 4, 5])
        self.assertEqual(missing, [4])
        self.assertEqual(missingtext, "4")
예제 #12
0
    def testSimple(self):
        coverage.erase()

        self.make_file("mycode.py", """\
            a = 1
            b = 2
            if b == 3:
                c = 4
            d = 5
            """)

        # Import the python file, executing it.
        coverage.start()
        self.import_module("mycode")            # pragma: recursive coverage
        coverage.stop()                         # pragma: recursive coverage

        _, statements, missing, missingtext = coverage.analysis("mycode.py")
        self.assertEqual(statements, [1,2,3,4,5])
        self.assertEqual(missing, [4])
        self.assertEqual(missingtext, "4")
예제 #13
0
    def test_simple(self):
        coverage.erase()

        self.make_file("mycode.py", """\
            a = 1
            b = 2
            if b == 3:
                c = 4
            d = 5
            """)

        # Import the python file, executing it.
        coverage.start()
        self.import_local_file("mycode")        # pragma: recursive coverage
        coverage.stop()                         # pragma: recursive coverage

        _, statements, missing, missingtext = coverage.analysis("mycode.py")
        self.assertEqual(statements, [1,2,3,4,5])
        self.assertEqual(missing, [4])
        self.assertEqual(missingtext, "4")
예제 #14
0
    def run_tests(self,
                  test_labels,
                  verbosity=1,
                  interactive=True,
                  extra_tests=[]):
        coveragemodules = getattr(settings, 'COVERAGE_MODULES', [])

        if coveragemodules:
            coverage.start()

        self.setup_test_environment()

        suite = self.build_suite(test_labels, extra_tests)
        old_config = self.setup_databases()
        result = self.run_suite(suite)

        if coveragemodules:
            coverage.stop()
            coveragedir = getattr(settings, 'COVERAGE_DIR', './build/coverage')
            if not os.path.exists(coveragedir):
                os.makedirs(coveragedir)

            modules = []
            for module_string in coveragemodules:
                module = __import__(module_string, globals(), locals(), [""])
                modules.append(module)
                f, s, m, mf = coverage.analysis(module)
                fp = file(os.path.join(coveragedir, module_string + ".html"),
                          "wb")
                colorize.colorize_file(f, outstream=fp, not_covered=mf)
                fp.close()
            coverage.report(modules, show_missing=0)
            coverage.erase()

        self.teardown_databases(old_config)
        self.teardown_test_environment()

        return len(result.failures) + len(result.errors)
예제 #15
0
파일: tests.py 프로젝트: akshell/tool
def main():
    try:
        cov_idx = sys.argv.index('--cov')
    except ValueError:
        coverage = None
    else:
        del sys.argv[cov_idx]
        try:
            import coverage
        except ImportError:
            sys.stderr.write('''\
Please install "coverage" module to collect coverage. Try typing:
sudo easy_install coverage
''')
            sys.exit(1)
        import coverage_color
        coverage.start()
    global akshell, script
    akshell = __import__('akshell')
    script = __import__('script')
    try:
        server_idx = sys.argv.index('--server')
    except ValueError:
        pass
    else:
        akshell.SERVER = sys.argv[server_idx + 1]
        del sys.argv[server_idx : server_idx + 2]
    try:
        unittest.main(defaultTest='suite')
    finally:
        if coverage:
            coverage.stop()
            for module in (akshell, script):
                path, stmts_, missing_, missing_str = coverage.analysis(module)
                with open('coverage_%s.html' % module.__name__, 'w') as f:
                    coverage_color.colorize_file(path, f, missing_str)
            coverage.report([akshell, script], show_missing=False)
            coverage.erase()
예제 #16
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGMultiPoint
            from _OGMultiPoint import *


        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGMultiPoint)
        print "\n"
        coverage.report(_OGMultiPoint)
예제 #17
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *
            import _Box
            from _Box import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Box)
        print "\n"
        coverage.report(_Box)
예제 #18
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGMultiLineString
            from _OGMultiLineString import *


        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGMultiLineString)
        print "\n"
        coverage.report(_OGMultiLineString)
예제 #19
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGLineString
            from _OGLineString import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGLineString)
        print "\n"
        coverage.report(_OGLineString)
예제 #20
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1        
            import _Point
            from _Point import *
            import _LineSeg
            from _LineSeg import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_LineSeg)
        print "\n"
        coverage.report(_LineSeg)
예제 #21
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGMultiPolygon
            from _OGMultiPolygon import *


        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGMultiPolygon)
        print "\n"
        coverage.report(_OGMultiPolygon)
예제 #22
0
파일: run.py 프로젝트: saif1413/L4OS
def main():
    """Main testing interface"""
    parser = OptionParser(add_help_option=False)
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
                      help="Run tests verbosely")
    parser.add_option("-q", "--quiet", action="store_true", dest="quiet",
                      help="Silent output (on success)")
    parser.add_option("-s", "--stop", action="store_true", dest="stop",
                      help="Stop")
    parser.add_option("-d", "--debug", action="store_true", dest="debug",
                      help="Debug (drop into PDB)")
    parser.add_option("-p", "--package", action="append", type="string", dest="package",
                      help="Only run tests for a specific package. (E.g: elf or weaver)")

    (options, args) = parser.parse_args()

    if args == []:
        args = glob.glob("test_*.py")
        args.sort()
    passed = True	# If a test fails set this to false
    for test_file in args:
        test_module = os.path.splitext(test_file)[0]
        fp, pathname, description = imp.find_module(test_module)
        start_coverage()
        module = imp.load_module(test_module, fp, pathname, description)
        result = unittest.TestResult()
        tested_modules = getattr(module, "modules_under_test", [])
        if options.package:
            skip = False
            for test_mod in tested_modules:
                package = test_mod.__name__.split(".")[0]
                if package not in options.package:
                    skip = True
                    break
            if skip:
                continue
        suite = unittest.defaultTestLoader.loadTestsFromModule(module)
        if options.debug:
            try:
                suite.debug()
            except:
                traceback.print_exc()
                _, _, tb = sys.exc_info()
                pdb.post_mortem(tb)
                sys.exit()
        else:
            suite.run(result)

        # Reload the modules under test
        for module in tested_modules:
            bits = module.__name__.split(".")
            module_name = bits[-1]
            if len(bits) > 1:
                path = [os.path.dirname(module.__file__)]
            else:
                path = None
            try:
                fp, pathname, description = imp.find_module(module_name, path)
            except ImportError:
                pdb.set_trace()
                print "Error loading", module, path
            imp.load_module(module_name + "_loaded_for_test", fp, pathname, description)

        coverage.stop()

        # Determine which modules do not have 100% coverage.  Print
        # coverage reports on those modules.
        coverage_print = []

        for mod in tested_modules:
            if len(coverage.analysis(mod)[2]):
                coverage_print.append(mod)

        # Result
        if not result.wasSuccessful() or coverage_print:
            print ">>> %s" % test_file

        if not result.wasSuccessful():
            for _t, err in result.errors + result.failures:
                print "=" * 80
                print _t
                print "=" * 80
                print err
            passed = False

        if coverage_print:
            coverage.report(coverage_print)
            print

    sys.exit(not passed)    # If a test failures return a non-zero return code
예제 #23
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            from _Point import *
            from _LineSeg import *
            import _Polygon
            from _Polygon import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Polygon)
        print "\n"
        coverage.report(_Polygon)
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGGeometryCollection
            from _OGGeometryCollection import *


        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGGeometryCollection)
        print "\n"
        coverage.report(_OGGeometryCollection)
예제 #25
0
파일: all.py 프로젝트: YECharles/Peach
	suites = []
	for m in allModules:
		suites.append(m.suite())
	
	return unittest.TestSuite(suites)

if __name__ == "__main__":
	COVERAGE_DIR = "coverage" # Where the HTML output should go
	COVERAGE_MODULES = ["Peach",
						"Peach.Engine.parser",
						"Peach.Engine.engine",
						"Peach.Engine.incoming",
						"Peach.Engine.dom",
						"Peach.Engine.state"
						] # The modules that you want colorized
	runner = unittest.TextTestRunner()
	coverage.start()
	runner.run(suite())
	coverage.stop()
	if not os.path.exists(COVERAGE_DIR):
		os.makedirs(COVERAGE_DIR)
	for module_string in COVERAGE_MODULES:
		module = __import__(module_string, globals(), locals(), [""])
		f,s,m,mf = coverage.analysis(module)
		fp = file(os.path.join(COVERAGE_DIR, module_string + ".html"), "wb")
		coverage_color.colorize_file(f, outstream=fp, not_covered=mf)
		fp.close()
	coverage.erase()

# end
예제 #26
0
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            from _Point import *
            from _LineSeg import *
            import _Polygon
            from _Polygon import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"


    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Polygon)
        print "\n"
        coverage.report(_Polygon)
예제 #27
0
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *
            import _Box
            from _Box import *
            
        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"


    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Box)
        print "\n"
        coverage.report(_Box)
예제 #28
0
if __name__ == "__main__":
    import os
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _PsycopgInit

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_PsycopgInit)
        print "\n"
        coverage.report(_PsycopgInit)
예제 #29
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import GeoTypes          

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"


    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(GeoTypes)
        print "\n"
        coverage.report(GeoTypes)


예제 #30
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGLinearRing
            from _OGLinearRing import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGLinearRing)
        print "\n"
        coverage.report(_OGLinearRing)
예제 #31
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Point)
        print "\n"
        coverage.report(_Point)
예제 #32
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *
            import _Circle
            from _Circle import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Circle)
        print "\n"
        coverage.report(_Circle)
예제 #33
0
if __name__ == "__main__":
    import os
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import GeoTypes

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(GeoTypes)
        print "\n"
        coverage.report(GeoTypes)
예제 #34
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGLineString
            from _OGLineString import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGLineString)
        print "\n"
        coverage.report(_OGLineString)
예제 #35
0
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *
            import _Circle
            from _Circle import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"


    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Circle)
        print "\n"
        coverage.report(_Circle)
예제 #36
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGPoint
            from _OGPoint import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGPoint)
        print "\n"
        coverage.report(_OGPoint)
예제 #37
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Point)
        print "\n"
        coverage.report(_Point)
예제 #38
0
        prog = testprogram.TestProgram(
            MODULE_NAMES,
            testRunner=test_runner,
            localServerProcess=testprogram.TwistedServerProcess(),
        )
        result = prog.runTests()

    if run_coverage:
        # HTML coverage report
        import colorize
        try:
            os.mkdir("coverage")
        except OSError:
            pass
        private_modules = glob.glob("mechanize/_*.py")
        private_modules.remove("mechanize/__init__.py")
        for module_filename in private_modules:
            module_name = module_filename.replace("/", ".")[:-3]
            print module_name
            module = sys.modules[module_name]
            f, s, m, mf = coverage.analysis(module)
            fo = open(os.path.join('coverage',
                                   os.path.basename(f) + '.html'), 'wb')
            colorize.colorize_file(f, outstream=fo, not_covered=mf)
            fo.close()
            coverage.report(module)
            #print coverage.analysis(module)

    # XXX exit status is wrong -- does not take account of doctests
    sys.exit(not result.wasSuccessful())
예제 #39
0
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _Point
            from _Point import *
            import _LineSeg
            from _LineSeg import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_LineSeg)
        print "\n"
        coverage.report(_LineSeg)
예제 #40
0
if __name__ == "__main__":
    if os.environ.get("USECOVERAGE") == "1":
        try:
            import coverage

            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGLinearRing
            from _OGLinearRing import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get("USEPYCHECK") == "1":
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGLinearRing)
        print "\n"
        coverage.report(_OGLinearRing)
예제 #41
0
if __name__ == "__main__":
    if os.environ.get('USECOVERAGE') == '1':
        try:
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            import _OGMultiPoint
            from _OGMultiPoint import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"

    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_OGMultiPoint)
        print "\n"
        coverage.report(_OGMultiPoint)
예제 #42
0
            import coverage
            coverage.erase()
            coverage.start()
            COVERAGE = 1
            from _Point import *
            from _LineSeg import *
            import _Path
            from _Path import *

        except:
            print "Error setting up coverage checking"
            COVERAGE = 0
    else:
        COVERAGE = 0

    if os.environ.get('USEPYCHECK') == '1':
        try:
            import pychecker.checker
        except:
            print "Pychecker not installed on this machine"



    unittest.TextTestRunner().run(testSuite())

    if COVERAGE:
        coverage.stop()
        x = coverage.analysis(_Path)
        print "\n"
        coverage.report(_Path)