From 0790e571a1819f6aaff82005a47132c2b6cd8494 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 20 Sep 2017 11:15:33 +0200 Subject: [PATCH] TST: skip test with optional files if not existing --- tests/test_offline.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_offline.py b/tests/test_offline.py index 25229c0..47e43a5 100644 --- a/tests/test_offline.py +++ b/tests/test_offline.py @@ -233,9 +233,12 @@ class TestOffline(unittest.TestCase): def test_objects(self, m): paths = ['cmd.exe', 'tmux', 'MachO-OSX-x64-ls'] - for path in paths: - json_blob = self.make_objects(os.path.join('tests', - 'viper-test-files', 'test_files', path)) + try: + for path in paths: + json_blob = self.make_objects(os.path.join('tests', + 'viper-test-files', 'test_files', path)) + except IOError: # Can be replaced with FileNotFoundError when support for python 2 is dropped + return unittest.SkipTest() print(json_blob) if __name__ == '__main__':