def test(): """Tests the `PyMeld` module, performing code coverage analysis if `Entrian.Coverage` is available. Returns `(failed, total)`, a la `doctest.testmod`.""" import doctest try: from Entrian import Coverage Coverage.start('PyMeld') except ImportError: Coverage = False ## # Profiling. ## import PyMeld ## import profile, pstats ## profile.run("import doctest, PyMeld; result = doctest.testmod(PyMeld)", "rjh") ## s = pstats.Stats("rjh") ## s.sort_stats('cumulative').print_stats() ## # Cheap benchmark, for comparing new versions with old. ## import PyMeld ## for i in range(100): ## reload(doctest) ## result = doctest.testmod(PyMeld) import PyMeld result = doctest.testmod(PyMeld) if Coverage: analysis = Coverage.getAnalysis() analysis.printAnalysis() return result
} def test(): """Tests the `PyMeldLite` module, performing code coverage analysis if `Entrian.Coverage` is available. Returns `(failed, total)`, a la `doctest.testmod`.""" import doctest try: from Entrian import Coverage Coverage.start('PyMeldLite') except ImportError: Coverage = False from . import PyMeldLite result = doctest.testmod(PyMeldLite) if Coverage: analysis = Coverage.getAnalysis() analysis.printAnalysis() return result