diff --git a/fs_uae_wrapper/cd32.py b/fs_uae_wrapper/cd32.py index fe5bc60..903babb 100644 --- a/fs_uae_wrapper/cd32.py +++ b/fs_uae_wrapper/cd32.py @@ -165,9 +165,8 @@ class CD32(object): if os.path.exists(self.save_filename): os.unlink(self.save_filename) - code = utils.run_command(['7z', 'a', self.save_filename, - os.path.join(self.dir, 'fs-uae-save')]) - if code != 0: + if not utils.run_command(['7z', 'a', self.save_filename, + os.path.join(self.dir, 'fs-uae-save')]): sys.stderr.write('Error: archiving save state failed\n') return False diff --git a/fs_uae_wrapper/utils.py b/fs_uae_wrapper/utils.py index c3bb1fb..41405d2 100644 --- a/fs_uae_wrapper/utils.py +++ b/fs_uae_wrapper/utils.py @@ -3,7 +3,6 @@ Misc utilities """ from distutils import spawn import os -import six import subprocess import sys try: @@ -109,11 +108,12 @@ def extract_archive(arch_name, show_gui_message, message_text): def run_command(cmd): """ Run provided command. Return true if command execution returns zero exit - code, false otherwise. If cmd is a string, there would be an attempt to - split it up for subprocess call method. + code, false otherwise. If cmd is not a list, there would be an attempt to + split it up for subprocess call method. May throw exception if cmd is not + a list neither a string. """ - if isinstance(six.text_type(cmd), six.string_types): + if not isinstance(cmd, list): cmd = cmd.split() code = subprocess.call(cmd) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ffe2fce..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -six diff --git a/tests/test_cd32.py b/tests/test_cd32.py index b456941..5e299d4 100644 --- a/tests/test_cd32.py +++ b/tests/test_cd32.py @@ -144,7 +144,7 @@ class TestCD32(TestCase): acd32 = cd32.CD32() acd32.dir = self.dirname acd32.save_filename = "foobar_save.7z" - run.return_value = 0 + run.return_value = True self.assertTrue(acd32._save_save()) @@ -157,7 +157,7 @@ class TestCD32(TestCase): os.mkdir(os.path.join(self.dirname, 'fs-uae-save')) self.assertTrue(acd32._save_save()) - run.return_value = 1 + run.return_value = False self.assertFalse(acd32._save_save()) @mock.patch('fs_uae_wrapper.utils.run_command') diff --git a/tox.ini b/tox.ini index a8bf4bf..6cc9c24 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,7 @@ usedevelop=True setenv = COVERAGE_FILE = .coverage commands = py.test --cov=fs_uae_wrapper --cov-report=term-missing -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -r{toxinidir}/test-requirements.txt [testenv:py27] deps = {[testenv]deps}