def test_set_bustools_binary_path_in_path(self): with mock.patch('kb_python.config.BUSTOOLS_PATH', None),\ mock.patch('kb_python.config.shutil.which', return_value='path/to/bustools'),\ mock.patch('kb_python.config.os.access', return_value=True): config.set_bustools_binary_path('bustools') self.assertEqual(os.path.abspath('path/to/bustools'), config.get_bustools_binary_path())
def test_get_bustools_binary_path_unsupported(self): with mock.patch('kb_python.config.os.path.exists') as exists: exists.return_value = False with self.assertRaises(config.UnsupportedOSException): config.get_bustools_binary_path()
def test_get_bustools_binary_path_windows(self): with mock.patch('kb_python.config.PLATFORM', 'windows'),\ mock.patch('kb_python.config.os.path.exists') as exists: exists.return_value = True self.assertTrue( config.get_bustools_binary_path().endswith('bustools.exe'))