コード例 #1
0
    def test_precommand_verbose_print_not_verbose_supress(
            self, DictWriter_mock, stdout_mock):
        DictWriter_mock.return_value = MagicMock()
        stdout_mock.flush = MagicMock()
        stdout_mock.write = MagicMock()
        writer_mock = DictWriter_mock.return_value
        writer_mock.writerow = MagicMock()

        verbose, suppress_cmd = False, False
        job_num, job_tot = 1, 1
        cmd = 'echo hello'
        parallel_lib.pre_command_verbose_print(verbose, suppress_cmd, cmd,
                                               job_num, job_tot)
        stdout_mock.write.assert_called_with('echo hello\n')
        sys.stdout = sys.__stdout__
コード例 #2
0
    def test_precommand_verbose_print_not_verbose_supress(
            self, DictWriter_mock, stdout_mock):
        DictWriter_mock.return_value = MagicMock()
        stdout_mock.flush = MagicMock()
        stdout_mock.write = MagicMock()
        writer_mock = DictWriter_mock.return_value
        writer_mock.writerow = MagicMock()

        verbose, suppress_cmd = False, False
        job_num, job_tot = 1, 1
        cmd = 'echo hello'
        parallel_lib.pre_command_verbose_print(
            verbose, suppress_cmd, cmd, job_num, job_tot)
        stdout_mock.write.assert_called_with('echo hello\n')
        sys.stdout = sys.__stdout__
コード例 #3
0
    def test_precommand_verbose_print_verbose_no_supress(
            self, DictWriter_mock, stdout_mock):
        DictWriter_mock.return_value = MagicMock()
        stdout_mock.flush = MagicMock()
        stdout_mock.write = MagicMock()
        writer_mock = DictWriter_mock.return_value
        writer_mock.writerow = MagicMock()

        verbose, suppress_cmd = True, False
        job_num, job_tot = 1, 1
        cmd = 'echo hello'
        parallel_lib.pre_command_verbose_print(verbose, suppress_cmd, cmd,
                                               job_num, job_tot)
        kwarg = writer_mock.writerow.call_args_list[0][0][0]
        self.assertTrue(writer_mock.writerow.called)
        self.assertEqual(kwarg['cmd'], 'echo hello')
        sys.stdout = sys.__stdout__
コード例 #4
0
    def test_precommand_verbose_print_verbose_no_supress(
            self, DictWriter_mock, stdout_mock):
        DictWriter_mock.return_value = MagicMock()
        stdout_mock.flush = MagicMock()
        stdout_mock.write = MagicMock()
        writer_mock = DictWriter_mock.return_value
        writer_mock.writerow = MagicMock()

        verbose, suppress_cmd = True, False
        job_num, job_tot = 1, 1
        cmd = 'echo hello'
        parallel_lib.pre_command_verbose_print(
            verbose, suppress_cmd, cmd, job_num, job_tot)
        kwarg = writer_mock.writerow.call_args_list[0][0][0]
        self.assertTrue(writer_mock.writerow.called)
        self.assertEqual(kwarg['cmd'], 'echo hello')
        sys.stdout = sys.__stdout__