def test_check(self, mocker): mock = mocker.patch('subprocess.check_call') parser = configparser.ConfigParser() parser.read_string('''[section] command = foo bar''') assert ExternalCommand.create( 'name', parser['section']).check() is not None mock.assert_called_once_with('foo bar', shell=True)
def test_check(self, mocker) -> None: mock = mocker.patch("subprocess.check_call") parser = configparser.ConfigParser() parser.read_string( """ [section] command = foo bar """ ) assert ( ExternalCommand.create("name", parser["section"]).check() is not None # type: ignore ) mock.assert_called_once_with("foo bar", shell=True)
def create_instance(self, name): return ExternalCommand(name, "asdfasdf")