コード例 #1
0
    def test_command_multiple_shell_failing(self):
        @command(command_type=Type.SHELL)
        def foo(*args, **kwargs):
            return [['foo'], ['bar']]

        args = ['foo']
        main = Main(args)
        with patch('clinner.run.base.Popen') as popen_mock:
            popen_mock.return_value.returncode = 1
            main.run()

        self.assertEqual(popen_mock.call_count, 1)
        self.assertEqual(popen_mock.call_args_list[0][1]['args'], ['foo'])
コード例 #2
0
    def test_command_multiple_shell_failing(self, cli):
        @command(command_type=Type.SHELL)
        def foo(*args, **kwargs):
            return [["foo"], ["bar"]]

        args = ["foo"]
        main = Main(args)
        with patch("clinner.run.base.Popen") as popen_mock:
            popen_mock.return_value.returncode = 1
            main.run()

        assert popen_mock.call_count == 1
        assert popen_mock.call_args_list[0][1]["args"] == ["foo"]

        del command.register["foo"]