class TestGpp(unittest.TestCase): def setUp(self): self.filename_cpp = 'foobar.cpp' self.compiler = Gpp(self.filename_cpp) @patch('universal.compiler.language.gpp.perform_system_command') def test_compile(self, mock_sys_cmd): self.compiler.compile() mock_sys_cmd.assert_called_once_with(AnyStringContaining('g++')) @patch('os.path.exists') @patch('universal.compiler.language.gpp.perform_system_command') def test_run_output_when_no_input_file_available(self, mock_sys_cmd, mock_path_exists): mock_path_exists.return_value = False self.compiler.run() mock_sys_cmd.assert_called_once_with(AnyStringContaining('foobar.out')) @patch('os.path.exists') @patch('universal.compiler.language.gpp.perform_system_command') def test_run_output_when_input_file_available(self, mock_sys_cmd, mock_path_exists): mock_path_exists.return_value = True self.compiler.run() mock_sys_cmd.assert_called_once_with(AnyStringContaining('foobar.input'))