Exemple #1
0
    def test_required_files_only_copied_if_exist(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = False

        pre_commit.main()

        self.assertEquals(0, copy.call_count)
    def test_required_files_only_copied_if_exist(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = False

        pre_commit.main()

        self.assertEquals(0, copy.call_count)
Exemple #3
0
    def test_required_files(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = True

        pre_commit.main()

        copy.assert_called_with('should_be_copied', ANY)
    def test_required_files(self, copy, isfile):
        self.testmod.REQUIRED_FILES = ['should_be_copied']
        isfile.return_value = True

        pre_commit.main()

        copy.assert_called_with('should_be_copied', ANY)
    def test_calling_run_with_args(self):
        self.HookConfig().arguments.return_value = 'yep'

        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir', 'yep')
Exemple #6
0
    def test_calling_run_with_args(self):
        self.HookConfig().arguments.return_value = 'yep'

        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir', 'yep')
    def test_calling_run_without_args(self, checks, HookConfig):
        HookConfig().is_enabled.return_value = True
        HookConfig().arguments.return_value = ''
        testmod = Mock()
        testmod.run.return_value = None

        checks.return_value = [("testmod", testmod)]

        result = pre_commit.main()

        self.assertEquals(result, 0)
        testmod.run.assert_called_with()
Exemple #8
0
    def test_calling_run_without_args(self, checks, HookConfig):
        HookConfig().is_enabled.return_value = True
        HookConfig().arguments.return_value = ''
        testmod = Mock()
        testmod.run.return_value = None

        checks.return_value = [("testmod", testmod)]

        result = pre_commit.main()

        self.assertEquals(result, 0)
        testmod.run.assert_called_with()
Exemple #9
0
    def test_calling_run_without_args(self):
        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['/tmp/dir/file_one'], '/tmp/dir')
    def test_calling_run_without_args(self):
        result = pre_commit.main()

        self.assertEquals(result, 0)
        self.testmod.run.assert_called_with(['file_one'], '/tmp/dir')