def check_versions(): t = DependencyTester() t.check_module_attr('gnuradio.blocks', 'GNU Radio', 'rotator_cc') t.check_module_attr('twisted.internet.task', 'Python library Twisted', 'react') t.check_module_attr('txws', 'Python library txWS', 'WebSocketProtocol.setBinaryMode') t.check_module_attr('six', 'Python library six', 'PY2') if t.report() != None: raise Exception(t.report())
def check_versions(): t = DependencyTester() t.check_module_attr('gnuradio.blocks', 'GNU Radio', 'rotator_cc') t.check_module_attr('twisted.internet.task', 'Python library Twisted', 'react') t.check_module_attr('txws', 'Python library txWS', 'WebSocketProtocol.setBinaryMode') t.check_module_attr('six', 'Python library six', 'PY2') t.check_module('ephem', 'Python library PyEphem') t.check_jsdep_file(__file__, 'deps/require.js', 'RequireJS') t.check_jsdep_file(__file__, 'deps/text.js', 'RequireJS') t.check_jsdep_file(__file__, 'deps/jasmine', 'Jasmine') return t.report()
class TestDependencyTester(unittest.TestCase): def setUp(self): self.t = DependencyTester() def test_module_ok(self): self.t.check_module('shinysdr.test.test_dependencies', '<dep name>') self.assertEqual(self.t.report(), None) def test_module_missing(self): self.t.check_module('shinysdr.nonexistent_module_name', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are missing:\n\t<dep name> (Check: shinysdr.nonexistent_module_name not present.)\nPlease (re)install current versions.') def test_module_broken_import(self): self.t.check_module('shinysdr.test.broken_deps.imports', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.imports failed to import (No module named nonexistent_module_in_dep).)\nPlease (re)install current versions.') def test_module_broken_other(self): self.t.check_module('shinysdr.test.broken_deps.misc', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.misc failed to import (boo).)\nPlease (re)install current versions.') def test_attr_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester') self.assertEqual(self.t.report(), None) def test_attr_path_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester.test_attr_path_ok') self.assertEqual(self.t.report(), None) def test_attr_missing(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'nonexistent_attr') self.assertEqual(self.t.report(), 'The following libraries/programs are too old:\n\t<dep name> (Check: shinysdr.test.test_dependencies.nonexistent_attr not present.)\nPlease (re)install current versions.')
class TestDependencyTester(unittest.TestCase): def setUp(self): self.t = DependencyTester() def test_module_ok(self): self.t.check_module('shinysdr.test.test_dependencies', '<dep name>') self.assertEqual(self.t.report(), None) def test_module_missing(self): self.t.check_module('shinysdr.nonexistent_module_name', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are missing:\n\t<dep name> (Check: shinysdr.nonexistent_module_name not present.)\nPlease (re)install current versions.') def test_module_broken_import(self): self.t.check_module('shinysdr.test.broken_deps.imports', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.imports failed to import (No module named nonexistent_module_in_dep).)\nPlease (re)install current versions.') def test_module_broken_other(self): self.t.check_module('shinysdr.test.broken_deps.misc', '<dep name>') self.assertEqual(self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.misc failed to import (boo).)\nPlease (re)install current versions.') def test_attr_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester') self.assertEqual(self.t.report(), None) def test_attr_path_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester.test_attr_path_ok') self.assertEqual(self.t.report(), None) def test_attr_missing(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'nonexistent_attr') self.assertEqual(self.t.report(), 'The following libraries/programs are too old:\n\t<dep name> (Check: shinysdr.test.test_dependencies.nonexistent_attr not present.)\nPlease (re)install current versions.') # note: 'broken attr' (hasattr true but it raises on get) is theoretically possible but hard to cause def test_file_ok(self): self.t.check_jsdep_file(__file__, 'broken_deps/__init__.py', '<dep name>') self.assertEqual(self.t.report(), None) def test_file_missing(self): self.t.check_jsdep_file(__file__, 'broken_deps/nonexistent_filename', '<dep name>') self.assertEqual(self.t.report(), 'The following files are missing:\n\t<dep name> (Check: ' + os.path.dirname(__file__) + '/broken_deps/nonexistent_filename does not exist.)\nPlease (re)run fetch-js-deps.sh and, if applicable, setup.py install.')
class TestDependencyTester(unittest.TestCase): def setUp(self): self.t = DependencyTester() def test_module_ok(self): self.t.check_module('shinysdr.test.test_dependencies', '<dep name>') self.assertEqual(self.t.report(), None) def test_module_missing(self): self.t.check_module('shinysdr.nonexistent_module_name', '<dep name>') self.assertEqual( self.t.report(), 'The following libraries/programs are missing:\n\t<dep name> (Check: shinysdr.nonexistent_module_name not present.)\nPlease (re)install current versions.' ) def test_module_broken_import(self): self.t.check_module('shinysdr.test.broken_deps.imports', '<dep name>') self.assertEqual( self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.imports failed to import (No module named nonexistent_module_in_dep).)\nPlease (re)install current versions.' ) def test_module_broken_other(self): self.t.check_module('shinysdr.test.broken_deps.misc', '<dep name>') self.assertEqual( self.t.report(), 'The following libraries/programs are not installed correctly:\n\t<dep name> (Check: shinysdr.test.broken_deps.misc failed to import (boo).)\nPlease (re)install current versions.' ) def test_attr_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester') self.assertEqual(self.t.report(), None) def test_attr_path_ok(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'TestDependencyTester.test_attr_path_ok') self.assertEqual(self.t.report(), None) def test_attr_missing(self): self.t.check_module_attr('shinysdr.test.test_dependencies', '<dep name>', 'nonexistent_attr') self.assertEqual( self.t.report(), 'The following libraries/programs are too old:\n\t<dep name> (Check: shinysdr.test.test_dependencies.nonexistent_attr not present.)\nPlease (re)install current versions.' ) # note: 'broken attr' (hasattr true but it raises on get) is theoretically possible but hard to cause def test_file_ok(self): self.t.check_jsdep_file(__file__, 'broken_deps/__init__.py', '<dep name>') self.assertEqual(self.t.report(), None) def test_file_missing(self): self.t.check_jsdep_file(__file__, 'broken_deps/nonexistent_filename', '<dep name>') self.assertEqual( self.t.report(), 'The following files are missing:\n\t<dep name> (Check: ' + os.path.dirname(__file__) + '/broken_deps/nonexistent_filename does not exist.)\nPlease (re)run fetch-js-deps.sh and, if applicable, setup.py install.' )