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