#----------------------------------------------------------------------------- __author__ = "Jai Ram Rideout" __copyright__ = "Copyright 2011-2013, The BIOM Format Development Team" __credits__ = ["Jai Ram Rideout"] __license__ = "BSD" __url__ = "http://biom-format.org" __maintainer__ = "Jai Ram Rideout" __email__ = "*****@*****.**" from biom.commands.installation_informer import InstallationInformer from biom.unit_test import TestCase, main class InstallationInformerTests(TestCase): def setUp(self): """Set up data for use in unit tests.""" self.cmd = InstallationInformer() def test_default(self): """Correctly returns info about the biom-format installation.""" # Not really sure what to specifically test here, as this information # will change on a per-install basis. Just make sure the code is being # exercised and we have some output. obs = self.cmd() self.assertEqual(obs.keys(), ['install_info_lines']) self.assertTrue(len(obs['install_info_lines']) > 0) if __name__ == "__main__": main()
return alltests class BoobyTrappedStream(object): def __init__(self, output): self.output = output def write(self, text): self.output.write(text) raise RuntimeError, "Output not allowed in tests" def flush(self): pass def isatty(self): return False if __name__ == '__main__': if '--debug' in sys.argv: s = suite() s.debug() else: orig = sys.stdout if '--output-ok' in sys.argv: sys.argv.remove('--output-ok') else: sys.stdout = BoobyTrappedStream(orig) try: unittest.main(defaultTest='suite', argv=sys.argv) finally: sys.stdout = orig