1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-18 20:10:26 +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():
return False
if not self._run_emulator(self.fsuae_options.list()):
if not self._run_emulator():
return False
if self._get_saves_dir():

View File

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

View File

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

View File

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

View File

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

View File

@@ -110,15 +110,22 @@ class TestBase(TestCase):
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
bobj.dir = self.dirname
self.assertTrue(bobj._run_emulator([]))
self.assertTrue(bobj._run_emulator())
run.assert_called_once_with(['fs-uae'])
# Errors from emulator are not fatal to wrappers
run.reset_mock()
run.return_value = False
self.assertTrue(bobj._run_emulator([]))
self.assertTrue(bobj._run_emulator())
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.utils.create_archive')
def test_save_save(self, carch, saves_dir):