3 # http://www.drdobbs.com/testing/unit-testing-with-python/240165163
11 localmodule = os.path.realpath(
12 os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
13 print('localmodule: ' + localmodule)
14 if localmodule not in sys.path:
15 sys.path.insert(0, localmodule)
17 import fdroidserver.common
18 import fdroidserver.install
21 class InstallTest(unittest.TestCase):
22 '''fdroidserver/install.py'''
24 def test_devices(self):
26 fdroidserver.common.fill_config_defaults(config)
27 fdroidserver.common.config = config
28 config['adb'] = fdroidserver.common.find_sdk_tools_cmd('adb')
29 self.assertTrue(os.path.exists(config['adb']))
30 self.assertTrue(os.path.isfile(config['adb']))
31 devices = fdroidserver.install.devices()
32 self.assertIsInstance(devices, list, 'install.devices() did not return a list!')
33 for device in devices:
34 self.assertIsInstance(device, str)
37 if __name__ == "__main__":
38 parser = optparse.OptionParser()
39 parser.add_option("-v", "--verbose", action="store_true", default=False,
40 help="Spew out even more information than normal")
41 (fdroidserver.install.options, args) = parser.parse_args(['--verbose'])
42 fdroidserver.common.options = fdroidserver.install.options
44 newSuite = unittest.TestSuite()
45 newSuite.addTest(unittest.makeSuite(InstallTest))
46 unittest.main(failfast=False)