Ejemplo n.º 1
0
class TestDependencyTester(unittest.TestCase):
    def setUp(self):
        self.t = DependencyTester()
    
    def test_module_ok(self):
        self.t.check_module('shinysdr.i.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.i.test_dependencies_cases.imports', '<dep name>')
        if six.PY2:
            self.assertEqual(self.t.report(),
                'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.imports failed to import (No module named nonexistent_module_in_dep).)\nPlease (re)install current versions.')
        else:
            self.assertEqual(self.t.report(),
                'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.imports failed to import (No module named \'shinysdr.test.nonexistent_module_in_dep\').)\nPlease (re)install current versions.')
    
    def test_module_broken_other(self):
        self.t.check_module('shinysdr.i.test_dependencies_cases.misc', '<dep name>')
        self.assertEqual(self.t.report(),
            'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.misc failed to import (boo).)\nPlease (re)install current versions.')
    
    def test_attr_ok(self):
        self.t.check_module_attr('shinysdr.i.test_dependencies', '<dep name>', 'TestDependencyTester')
        self.assertEqual(self.t.report(), None)
    
    def test_attr_path_ok(self):
        self.t.check_module_attr('shinysdr.i.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.i.test_dependencies', '<dep name>', 'nonexistent_attr')
        self.assertEqual(self.t.report(),
            'The following libraries/programs are too old:\n\t<dep name>  (Check: shinysdr.i.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__, 'test_dependencies_cases/__init__.py', '<dep name>')
        self.assertEqual(self.t.report(), None)
    
    def test_file_missing(self):
        self.t.check_jsdep_file(__file__, 'test_dependencies_cases/nonexistent_filename', '<dep name>')
        self.assertEqual(self.t.report(),
            'The following files are missing:\n\t<dep name>  (Check: ' + os.path.dirname(__file__) + '/test_dependencies_cases/nonexistent_filename does not exist.)\nPlease (re)run fetch-js-deps.sh and, if applicable, setup.py install.')
Ejemplo n.º 2
0
class TestDependencyTester(unittest.TestCase):
    def setUp(self):
        self.t = DependencyTester()
    
    def test_module_ok(self):
        self.t.check_module('shinysdr.i.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.i.test_dependencies_cases.imports', '<dep name>')
        if six.PY2:
            self.assertEqual(self.t.report(),
                'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.imports failed to import (No module named nonexistent_module_in_dep).)\nPlease (re)install current versions.')
        else:
            self.assertEqual(self.t.report(),
                'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.imports failed to import (No module named \'shinysdr.test.nonexistent_module_in_dep\').)\nPlease (re)install current versions.')
    
    def test_module_broken_other(self):
        self.t.check_module('shinysdr.i.test_dependencies_cases.misc', '<dep name>')
        self.assertEqual(self.t.report(),
            'The following libraries/programs are not installed correctly:\n\t<dep name>  (Check: shinysdr.i.test_dependencies_cases.misc failed to import (boo).)\nPlease (re)install current versions.')
    
    def test_attr_ok(self):
        self.t.check_module_attr('shinysdr.i.test_dependencies', '<dep name>', 'TestDependencyTester')
        self.assertEqual(self.t.report(), None)
    
    def test_attr_path_ok(self):
        self.t.check_module_attr('shinysdr.i.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.i.test_dependencies', '<dep name>', 'nonexistent_attr')
        self.assertEqual(self.t.report(),
            'The following libraries/programs are too old:\n\t<dep name>  (Check: shinysdr.i.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__, 'test_dependencies_cases/__init__.py', '<dep name>')
        self.assertEqual(self.t.report(), None)
    
    def test_file_missing(self):
        self.t.check_jsdep_file(__file__, 'test_dependencies_cases/nonexistent_filename', '<dep name>')
        self.assertEqual(self.t.report(),
            'The following files are missing:\n\t<dep name>  (Check: ' + os.path.dirname(__file__) + '/test_dependencies_cases/nonexistent_filename does not exist.)\nPlease (re)run setup.py fetch_deps and following installation steps.')
Ejemplo n.º 3
0
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_module('serial', 'Python library PySerial')
    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()
Ejemplo n.º 4
0
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_module('serial', 'Python library PySerial')
    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()