def test(verbose=False, heavy=False): """Run all the tests in the test suite. If *verbose* is set, the test suite will emit messages with full verbosity (not recommended unless you are looking into a certain problem). If *heavy* is set, the test suite will be run in *heavy* mode (you should be careful with this because it can take a lot of time and resources from your computer). Return 0 (os.EX_OK) if all tests pass, 1 in case of failure """ print_versions() print_heavy(heavy) # What a context this is! #oldverbose, common.verbose = common.verbose, verbose oldheavy, common.heavy = common.heavy, heavy try: result = unittest.TextTestRunner(verbosity=1 + int(verbose)).run( suite()) if result.wasSuccessful(): return 0 else: return 1 finally: #common.verbose = oldverbose common.heavy = oldheavy # there are pretty young heavies, too ;)
def test(verbose=False, heavy=False): """Run all the tests in the test suite. If *verbose* is set, the test suite will emit messages with full verbosity (not recommended unless you are looking into a certain problem). If *heavy* is set, the test suite will be run in *heavy* mode (you should be careful with this because it can take a lot of time and resources from your computer). Return 0 (os.EX_OK) if all tests pass, 1 in case of failure """ print_versions() print_heavy(heavy) # What a context this is! #oldverbose, common.verbose = common.verbose, verbose oldheavy, common.heavy = common.heavy, heavy try: result = unittest.TextTestRunner(verbosity=1+int(verbose)).run(suite()) if result.wasSuccessful(): return 0 else: return 1 finally: #common.verbose = oldverbose common.heavy = oldheavy # there are pretty young heavies, too ;)
def test_from_kind_05(self): # ValueError: no default item size for kind ``string`` self.assertRaises(ValueError, Atom.from_kind, 'string', dflt=b'hello') def test_from_kind_06(self): # ValueError: unknown kind: 'Float' self.assertRaises(ValueError, Atom.from_kind, 'Float') def suite(): import doctest import tables.atom theSuite = unittest.TestSuite() for i in range(1): theSuite.addTest(doctest.DocTestSuite(tables.atom)) theSuite.addTest(unittest.makeSuite(AtomTestCase)) theSuite.addTest(unittest.makeSuite(RangeTestCase)) theSuite.addTest(unittest.makeSuite(DtypeTestCase)) theSuite.addTest(unittest.makeSuite(ReadFloatTestCase)) return theSuite if __name__ == '__main__': common.parse_argv(sys.argv) common.print_versions() unittest.main(defaultTest='suite')
classCount[objClass] += 1 else: classCount[objClass] = 1 incidence = ['``%s``: %d' % (cls, cnt) for (cls, cnt) in classCount.iteritems()] print("Class incidence:", ', '.join(incidence)) self.fail("Possible leak: %d uncollected objects." % garbageLen) def suite(): """Return a test suite consisting of all the test cases in the module.""" theSuite = unittest.TestSuite() theSuite.addTest(unittest.makeSuite(GarbageTestCase)) return theSuite if __name__ == '__main__': import sys common.parse_argv(sys.argv) common.print_versions() unittest.main(defaultTest='suite') ## Local Variables: ## mode: python ## py-indent-offset: 4 ## tab-width: 4 ## fill-column: 72 ## End:
if __name__ == '__main__': common.parse_argv(sys.argv) hdf5_version = get_tuple_version(tables.which_lib_version("hdf5")[0]) hdf5_version_str = "%s.%s.%s" % hdf5_version if hdf5_version_str < min_hdf5_version: print("*Warning*: HDF5 version is lower than recommended: %s < %s" % (hdf5_version, min_hdf5_version)) if numpy.__version__ < min_numpy_version: print("*Warning*: NumPy version is lower than recommended: %s < %s" % (numpy.__version__, min_numpy_version)) # Handle some global flags (i.e. only useful for test_all.py) only_versions = 0 args = sys.argv[:] for arg in args: # Remove 'show-versions' for PyTables 2.3 or higher if arg in ['--print-versions', '--show-versions']: only_versions = True sys.argv.remove(arg) elif arg == '--show-memory': common.show_memory = True sys.argv.remove(arg) print_versions() if not only_versions: print_heavy(common.heavy) unittest.main(defaultTest='tables.tests.suite')
if __name__ == '__main__': common.parse_argv(sys.argv) hdf5_version = get_tuple_version(tables.which_lib_version("hdf5")[0]) if hdf5_version < min_hdf5_version: print("*Warning*: HDF5 version is lower than recommended: %s < %s" % (hdf5_version, min_hdf5_version)) if numpy.__version__ < min_numpy_version: print("*Warning*: NumPy version is lower than recommended: %s < %s" % (numpy.__version__, min_numpy_version)) # Handle some global flags (i.e. only useful for test_all.py) only_versions = 0 args = sys.argv[:] for arg in args: # Remove 'show-versions' for PyTables 2.3 or higher if arg in ['--print-versions', '--show-versions']: only_versions = True sys.argv.remove(arg) elif arg == '--show-memory': common.show_memory = True sys.argv.remove(arg) print_versions() if not only_versions: print_heavy(common.heavy) unittest.main(defaultTest='tables.tests.suite')