Skip to content

Commit 20b18e6

Browse files
committed
Fix tests
1 parent 00762f7 commit 20b18e6

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

setuptools_git_versioning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def get_tags(
103103
root: str | os.PathLike | None = None,
104104
) -> list[str]:
105105
"""Return list of tags merged into HEAD history tree"""
106-
tags = _exec("git", "tag", f"--sort=-{sort_by} --merged", root=root)
106+
tags = _exec("git", "tag", f"--sort=-{sort_by}", "--merged", root=root)
107107
if filter_callback:
108108
# pull the tags that don't start with tag_prefix out of the list
109109
return list(filter(filter_callback, tags))

tests/conftest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import shutil
32
import textwrap
43
from pathlib import Path
54

@@ -11,8 +10,8 @@
1110

1211

1312
@pytest.fixture
14-
def repo_dir(temp_path_factory: pytest.TempPathFactory):
15-
repo_dir = temp_path_factory.mktemp("repo")
13+
def repo_dir(tmp_path_factory: pytest.TempPathFactory):
14+
repo_dir = tmp_path_factory.mktemp("repo")
1615
coveragerc = root.joinpath(".coveragerc")
1716
reports = repo_dir.joinpath("reports")
1817

@@ -26,9 +25,8 @@ def repo_dir(temp_path_factory: pytest.TempPathFactory):
2625

2726
if os.environ.get("CI", "false").lower() in ["1", "true"]:
2827
# move collect coverage data to reports directory
29-
for root_path, _dirs, files in os.walk(reports):
30-
for file in files:
31-
shutil.move(root_path / file, reports / file)
28+
for file in reports.glob("*"):
29+
file.rename(reports / file.name)
3230

3331

3432
@pytest.fixture

tests/lib/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def get_version_setup_py(cwd: str | os.PathLike, **kwargs) -> str:
306306

307307

308308
def get_version_module(cwd: str | os.PathLike, args: list[str] | None = None, **kwargs) -> str:
309-
args_str = " ".join(args or [])
309+
args_str = " ".join(map(str, args or []))
310310

311311
return execute(
312312
cwd,
@@ -316,7 +316,7 @@ def get_version_module(cwd: str | os.PathLike, args: list[str] | None = None, **
316316

317317

318318
def get_version_script(cwd: str | os.PathLike, args: list[str] | None = None, **kwargs) -> str:
319-
args_str = " ".join(args or [])
319+
args_str = " ".join(map(str, args or []))
320320
return execute(cwd, f"setuptools-git-versioning {args_str} -vv", **kwargs).strip()
321321

322322

0 commit comments

Comments
 (0)