Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions testing/utilities/cwd.py

This file was deleted.

5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from git_code_debt.util import yaml
from git_code_debt.util.subprocess import cmd_output
from testing.utilities.auto_namedtuple import auto_namedtuple
from testing.utilities.cwd import cwd


@pytest.fixture
Expand Down Expand Up @@ -70,7 +69,7 @@ def sandbox(tempdir_factory):
@pytest.fixture
def cloneable(tempdir_factory):
repo_path = tempdir_factory.get()
with cwd(repo_path):
with contextlib.chdir(repo_path):
subprocess.check_call(('git', 'init', '.'))
subprocess.check_call(('git', 'commit', '-m', 'foo', '--allow-empty'))

Expand Down Expand Up @@ -98,7 +97,7 @@ def make_commit(filename, contents):
))
append_commit()

with cwd(cloneable):
with contextlib.chdir(cloneable):
# Append a commit for the inital commit
append_commit()
make_commit('bar.py', '')
Expand Down
10 changes: 5 additions & 5 deletions tests/generate_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import collections
import contextlib
import os.path
import re
import sqlite3
Expand All @@ -19,7 +20,6 @@
from git_code_debt.metrics.lines import LinesOfCodeParser
from git_code_debt.repo_parser import RepoParser
from git_code_debt.util.subprocess import cmd_output
from testing.utilities.cwd import cwd


def test_increment_metrics_first_time():
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_generate_new_data_created(sandbox, cloneable_with_commits):
main(('-C', cfg))
before_data_count = get_metric_data_count(sandbox)
# Add some commits
with cwd(cloneable_with_commits.path):
with contextlib.chdir(cloneable_with_commits.path):
with open('new_file.py', 'w') as f:
f.write('# test\n')
cmd_output('git', 'add', 'new_file.py')
Expand All @@ -111,7 +111,7 @@ def test_generate_new_data_created(sandbox, cloneable_with_commits):

def test_regression_for_issue_10(sandbox, cloneable):
# Create a commit, then create another commit at a previous time
with cwd(cloneable):
with contextlib.chdir(cloneable):
cmd_output(
'git', 'commit', '--allow-empty', '-m', 'c1',
env=dict(
Expand All @@ -135,7 +135,7 @@ def test_regression_for_issue_10(sandbox, cloneable):


def test_moves_handled_properly(sandbox, cloneable):
with cwd(cloneable):
with contextlib.chdir(cloneable):
with open('f', 'w') as f:
f.write('foo\nbar\nbaz\n')
cmd_output('git', 'add', 'f')
Expand All @@ -148,7 +148,7 @@ def test_moves_handled_properly(sandbox, cloneable):


def test_internal_zero_populated(sandbox, cloneable):
with cwd(cloneable):
with contextlib.chdir(cloneable):
with open('f.py', 'w') as f:
f.write('# hello world\n')
cmd_output('git', 'add', 'f.py')
Expand Down
Loading