1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-19 12:28:12 +01:00

Get rid of unneeded _run_emulator parameter

This commit is contained in:
2017-01-07 13:24:23 +01:00
parent ab4042f880
commit 8528d28a42
6 changed files with 19 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ class Wrapper(base.ArchiveBase):
if not self._copy_conf(): if not self._copy_conf():
return False return False
if not self._run_emulator(self.fsuae_options.list()): if not self._run_emulator():
return False return False
if self._get_saves_dir(): if self._get_saves_dir():

View File

@@ -78,11 +78,11 @@ class Base(object):
os.path.join(self.dir, 'Config.fs-uae')) os.path.join(self.dir, 'Config.fs-uae'))
return True return True
def _run_emulator(self, fsuae_options): def _run_emulator(self):
"""execute fs-uae in provided directory""" """execute fs-uae"""
curdir = os.path.abspath('.') curdir = os.path.abspath('.')
os.chdir(self.dir) os.chdir(self.dir)
utils.run_command(['fs-uae'] + fsuae_options) utils.run_command(['fs-uae'] + self.fsuae_options.list())
os.chdir(curdir) os.chdir(curdir)
return True return True

View File

@@ -39,7 +39,7 @@ class Wrapper(base.ArchiveBase):
if not method(): if not method():
return False return False
if not self._run_emulator(self.fsuae_options.list()): if not self._run_emulator():
return False return False
if self._get_saves_dir(): if self._get_saves_dir():

View File

@@ -38,7 +38,7 @@ class Wrapper(base.Base):
if not self._copy_conf(): if not self._copy_conf():
return False return False
if not self._run_emulator(self.fsuae_options.list()): if not self._run_emulator():
return False return False
if self._get_saves_dir(): if self._get_saves_dir():

View File

@@ -46,9 +46,9 @@ def usage():
def run(): def run():
"""run wrapper module""" """run wrapper module"""
config_file, cmd_options = parse_args() config_file, fsuae_options = parse_args()
if 'help' in cmd_options: if 'help' in fsuae_options:
usage() usage()
sys.exit(0) sys.exit(0)
@@ -63,7 +63,7 @@ def run():
sys.stderr.write('Error: Configuration file have syntax issues\n') sys.stderr.write('Error: Configuration file have syntax issues\n')
sys.exit(2) sys.exit(2)
wrapper_module = cmd_options.get(WRAPPER_KEY) wrapper_module = fsuae_options.get(WRAPPER_KEY)
if not wrapper_module: if not wrapper_module:
wrapper_module = configuration.get(WRAPPER_KEY) wrapper_module = configuration.get(WRAPPER_KEY)
@@ -78,7 +78,7 @@ def run():
"exists.\n" % wrapper_module) "exists.\n" % wrapper_module)
sys.exit(3) sys.exit(3)
if not wrapper.run(config_file, cmd_options, configuration): if not wrapper.run(config_file, fsuae_options, configuration):
sys.exit(4) sys.exit(4)

View File

@@ -110,15 +110,22 @@ class TestBase(TestCase):
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {}) bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
bobj.dir = self.dirname bobj.dir = self.dirname
self.assertTrue(bobj._run_emulator([])) self.assertTrue(bobj._run_emulator())
run.assert_called_once_with(['fs-uae']) run.assert_called_once_with(['fs-uae'])
# Errors from emulator are not fatal to wrappers # Errors from emulator are not fatal to wrappers
run.reset_mock() run.reset_mock()
run.return_value = False run.return_value = False
self.assertTrue(bobj._run_emulator([])) self.assertTrue(bobj._run_emulator())
run.assert_called_once_with(['fs-uae']) run.assert_called_once_with(['fs-uae'])
# pass the options
bobj.fsuae_options = utils.CmdOption({'foo': '1'})
run.reset_mock()
run.return_value = False
self.assertTrue(bobj._run_emulator())
run.assert_called_once_with(['fs-uae', '--foo'])
@mock.patch('fs_uae_wrapper.base.Base._get_saves_dir') @mock.patch('fs_uae_wrapper.base.Base._get_saves_dir')
@mock.patch('fs_uae_wrapper.utils.create_archive') @mock.patch('fs_uae_wrapper.utils.create_archive')
def test_save_save(self, carch, saves_dir): def test_save_save(self, carch, saves_dir):