Skip to content

Commit 96d2ada

Browse files
committed
refactor(tests): Rename parentdir -> repos_path
1 parent 206e1fb commit 96d2ada

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

tests/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def user_path(home_path: pathlib.Path):
2222

2323

2424
@pytest.fixture(scope="function")
25-
def parentdir(user_path: pathlib.Path, request: pytest.FixtureRequest):
25+
def repos_path(user_path: pathlib.Path, request: pytest.FixtureRequest):
2626
"""Return temporary directory for repository checkout guaranteed unique."""
2727
dir = user_path / "repos"
2828
dir.mkdir(exist_ok=True)
@@ -35,12 +35,12 @@ def clean():
3535

3636

3737
@pytest.fixture
38-
def pip_url_kwargs(parentdir: pathlib.Path, git_remote: pathlib.Path):
38+
def pip_url_kwargs(repos_path: pathlib.Path, git_remote: pathlib.Path):
3939
"""Return kwargs for :func:`create_repo_from_pip_url`."""
4040
repo_name = "repo_clone"
4141
return {
4242
"pip_url": f"git+file://{git_remote}",
43-
"repo_dir": parentdir / repo_name,
43+
"repo_dir": repos_path / repo_name,
4444
}
4545

4646

@@ -53,12 +53,12 @@ def git_repo(pip_url_kwargs: Dict):
5353

5454

5555
@pytest.fixture
56-
def git_remote(parentdir: pathlib.Path):
56+
def git_remote(repos_path: pathlib.Path):
5757
"""Create a git repo with 1 commit, used as a remote."""
5858
name = "dummyrepo"
59-
repo_dir = parentdir / name
59+
repo_dir = repos_path / name
6060

61-
run(["git", "init", name], cwd=parentdir)
61+
run(["git", "init", name], cwd=repos_path)
6262

6363
testfile_filename = "testfile.test"
6464

tests/test_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def test_repr_base():
2424

2525

2626
def test_ensure_dir_creates_parent_if_not_exist(tmp_path: pathlib.Path):
27-
parentdir = tmp_path / "parentdir" # doesn't exist yet
28-
repo_dir = parentdir / "myrepo"
27+
repos_path = tmp_path / "repos_path" # doesn't exist yet
28+
repo_dir = repos_path / "myrepo"
2929
repo = BaseRepo(url="file://path/to/myrepo", repo_dir=repo_dir)
3030

3131
repo.ensure_dir()
32-
assert parentdir.is_dir()
32+
assert repos_path.is_dir()
3333

3434

3535
def test_convert_pip_url():

tests/test_git.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ def progress_callback_spy(output, timestamp):
122122
assert progress_callback.called
123123

124124

125-
def test_remotes(parentdir, git_remote):
125+
def test_remotes(repos_path, git_remote):
126126
repo_name = "myrepo"
127127
remote_name = "myremote"
128128
remote_url = "https://localhost/my/git/repo.git"
129129

130130
git_repo = create_repo_from_pip_url(
131131
pip_url=f"git+file://{git_remote}",
132-
repo_dir=parentdir / repo_name,
132+
repo_dir=repos_path / repo_name,
133133
)
134134
git_repo.obtain()
135135
git_repo.set_remote(name=remote_name, url=remote_url)
@@ -160,10 +160,10 @@ def test_git_get_url_and_rev_from_pip_url():
160160
assert rev == "eucalyptus"
161161

162162

163-
def test_remotes_preserves_git_ssh(parentdir, git_remote):
163+
def test_remotes_preserves_git_ssh(repos_path, git_remote):
164164
# Regression test for #14
165165
repo_name = "myexamplegit"
166-
repo_dir = parentdir / repo_name
166+
repo_dir = repos_path / repo_name
167167
remote_name = "myremote"
168168
remote_url = "git+ssh://git@github.com/tony/AlgoXY.git"
169169

tests/test_hg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ def hgrc_default(monkeypatch: pytest.MonkeyPatch, user_path: pathlib.Path):
3737

3838

3939
@pytest.fixture
40-
def hg_remote(parentdir):
40+
def hg_remote(repos_path):
4141
"""Create a git repo with 1 commit, used as a remote."""
4242
name = "test_hg_repo"
43-
repo_path = parentdir / name
43+
repo_path = repos_path / name
4444

45-
run(["hg", "init", name], cwd=parentdir)
45+
run(["hg", "init", name], cwd=repos_path)
4646

4747
testfile_filename = "testfile.test"
4848

@@ -53,13 +53,13 @@ def hg_remote(parentdir):
5353
return repo_path
5454

5555

56-
def test_repo_mercurial(tmp_path: pathlib.Path, parentdir, hg_remote):
56+
def test_repo_mercurial(tmp_path: pathlib.Path, repos_path, hg_remote):
5757
repo_name = "my_mercurial_project"
5858

5959
mercurial_repo = create_repo_from_pip_url(
6060
**{
6161
"pip_url": f"hg+file://{hg_remote}",
62-
"repo_dir": parentdir / repo_name,
62+
"repo_dir": repos_path / repo_name,
6363
}
6464
)
6565

@@ -68,7 +68,7 @@ def test_repo_mercurial(tmp_path: pathlib.Path, parentdir, hg_remote):
6868
mercurial_repo.update_repo()
6969

7070
test_repo_revision = run(
71-
["hg", "parents", "--template={rev}"], cwd=parentdir / repo_name
71+
["hg", "parents", "--template={rev}"], cwd=repos_path / repo_name
7272
)
7373

7474
assert mercurial_repo.get_revision() == test_repo_revision

tests/test_svn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313

1414
@pytest.fixture
15-
def svn_remote(parentdir, scope="session"):
15+
def svn_remote(repos_path, scope="session"):
1616
"""Create a git repo with 1 commit, used as a remote."""
1717
server_dirname = "server_dir"
18-
server_dir = parentdir / server_dirname
18+
server_dir = repos_path / server_dirname
1919

2020
run(["svnadmin", "create", server_dir])
2121

0 commit comments

Comments
 (0)