Skip to content

Commit

Permalink
Remove pytest-git
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Sep 23, 2024
1 parent 69c8193 commit e620651
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pytest
pytest-git
17 changes: 12 additions & 5 deletions test/test_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import tempfile


@pytest.fixture
def repo(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
subprocess.run("git init", shell=True)
return tmp_path


@pytest.mark.parametrize("testcase", [("helloworld.cc", "helloworld_format.cc")])
def test_clang_format(testcase):
# Get full paths to the test data
Expand All @@ -21,14 +28,14 @@ def test_clang_format(testcase):
assert filecmp.cmp(outname, test_output)


def test_git_clang_format(git_repo):
def test_git_clang_format(repo):
# Test whether the git-clang-format tool is properly executable
# on an empty git repository.

# Create a commit with an empty file
open(os.path.join(git_repo.workspace, "test"), "w").close()
git_repo.run("git add test")
git_repo.run("git commit -m initial")
open(repo / "test", "w").close()
subprocess.run("git add test", shell=True)
subprocess.run("git commit -m initial", shell=True)

# Check that the clang-format tool runs on the test repo
git_repo.run("git clang-format")
subprocess.run("git clang-format", shell=True)

0 comments on commit e620651

Please sign in to comment.