Skip to content

Commit

Permalink
Mark test_diff_submodule xfail on Windows
Browse files Browse the repository at this point in the history
Everything attempted in the test case method is actually working
and passes, but when the tearDown method calls shutil.rmtree, it
fails with "Access is denied" and raises PermissionError. The
reason and exception are accordingly noted in the xfail decoration.

While adding a pytest import to apply the pytest xfail mark, I also
improved grouping/sorting of other imports in the test_diff module.
  • Loading branch information
EliahKagan committed Nov 16, 2023
1 parent cd9d7a9 commit f72e282
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions test/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import ddt
import os
import os.path as osp
import shutil
import tempfile
from git import (
Repo,
GitCommandError,
Diff,
DiffIndex,
NULL_TREE,
Submodule,
)
from git.cmd import Git
from test.lib import (
TestBase,
StringProcessAdapter,
fixture,
)
from test.lib import with_rw_directory

import os.path as osp
import ddt
import pytest

from git import NULL_TREE, Diff, DiffIndex, GitCommandError, Repo, Submodule
from git.cmd import Git
from test.lib import StringProcessAdapter, TestBase, fixture, with_rw_directory


def to_raw(input):
Expand Down Expand Up @@ -318,6 +309,11 @@ def test_diff_with_spaces(self):
self.assertIsNone(diff_index[0].a_path, repr(diff_index[0].a_path))
self.assertEqual(diff_index[0].b_path, "file with spaces", repr(diff_index[0].b_path))

@pytest.mark.xfail(
os.name == "nt",
reason='"Access is denied" when tearDown calls shutil.rmtree',
raises=PermissionError,
)
def test_diff_submodule(self):
"""Test that diff is able to correctly diff commits that cover submodule changes"""
# Init a temp git repo that will be referenced as a submodule.
Expand Down

0 comments on commit f72e282

Please sign in to comment.