From 364bb9ae59ad23401f1b80ca14cc7e9bbdf8efd7 Mon Sep 17 00:00:00 2001 From: gryf Date: Sat, 31 Dec 2016 19:25:41 +0100 Subject: [PATCH] Added test for run emulator for cd32 module --- tests/test_cd32.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/test_cd32.py b/tests/test_cd32.py index 15f2e64..0a63e03 100644 --- a/tests/test_cd32.py +++ b/tests/test_cd32.py @@ -1,8 +1,9 @@ import os import sys +import shutil +import subprocess from tempfile import mkstemp, mkdtemp from unittest import TestCase -import shutil try: from unittest import mock @@ -117,3 +118,18 @@ class TestCD32(TestCase): utils_extract.return_value = False self.assertFalse(acd32._extract()) utils_extract.assert_called_once_with(self.fname, '1', 'arch.7z') + + @mock.patch('subprocess.call') + def test_run_game(self, sub_call): + + acd32 = cd32.CD32() + acd32.dir = self.dirname + + self.assertTrue(acd32._run_game([])) + sub_call.assert_called_once_with(['fs-uae']) + + # Errors from emulator are not fatal to wrappers + sub_call.reset_mock() + sub_call.side_effect = subprocess.CalledProcessError(2, 'fs-uae') + self.assertTrue(acd32._run_game([])) + sub_call.assert_called_once_with(['fs-uae'])