at master 2.9 kB view raw
1The test suite has support for comparing results against a base revision of the 2repository. 3 4This requires that we run the tests from a Git checkout of the `beetcamp` repo, 5which we do not do. We don't want to compare against a base revision, so we 6just remove the option entirely. 7 8diff --git a/tests/conftest.py b/tests/conftest.py 9index 04d81f66f0..018d9e3c0c 100644 10--- a/tests/conftest.py 11+++ b/tests/conftest.py 12@@ -9,7 +9,6 @@ 13 14 import pytest 15 from beets.autotag.hooks import AlbumInfo, TrackInfo 16-from git import Repo 17 from rich_tables.diff import pretty_diff 18 from rich_tables.utils import make_console 19 20@@ -17,10 +16,8 @@ 21 from beetsplug.bandcamp.helpers import Helpers 22 23 if TYPE_CHECKING: 24- from _pytest.config import Config 25 from _pytest.config.argparsing import Parser 26 from _pytest.fixtures import SubRequest 27- from _pytest.terminal import TerminalReporter 28 from rich.console import Console 29 30 31@@ -29,28 +26,6 @@ 32 33 34 def pytest_addoption(parser: Parser) -> None: 35- newest_folders = sorted( 36- (p for p in Path("lib_tests").glob("*") if p.is_dir()), 37- key=lambda p: p.stat().st_ctime, 38- reverse=True, 39- ) 40- all_names = [f.name for f in newest_folders] 41- names = [n for n in all_names if n != "dev"] 42- names_set = set(names) 43- 44- base_name = "" 45- for commit in Repo(".").iter_commits(paths=["./beetsplug"]): 46- short_commit = str(commit)[:8] 47- if short_commit in names_set: 48- base_name = short_commit 49- break 50- 51- parser.addoption( 52- "--base", 53- choices=all_names, 54- default=base_name or "dev", 55- help="base directory / comparing against", 56- ) 57 parser.addoption( 58 "--target", 59 default="dev", 60@@ -64,16 +39,6 @@ 61 ) 62 63 64-def pytest_terminal_summary( 65- terminalreporter: TerminalReporter, 66- exitstatus: int, # noqa: ARG001 67- config: Config, 68-) -> None: 69- base = config.getoption("base") 70- target = config.getoption("target") 71- terminalreporter.write(f"--- Compared {target} against {base} ---\n") 72- 73- 74 def pytest_assertrepr_compare(op: str, left: Any, right: Any): # noqa: ARG001 75 """Pretty print the difference between dict objects.""" 76 actual, expected = left, right 77diff --git a/tests/test_lib.py b/tests/test_lib.py 78index 665d5aa61d..0a81e42b24 100644 79--- a/tests/test_lib.py 80+++ b/tests/test_lib.py 81@@ -19,7 +19,6 @@ 82 83 import pytest 84 from filelock import FileLock 85-from git import Repo 86 from rich import box 87 from rich.console import Group 88 from rich.markup import escape 89@@ -273,9 +272,6 @@ 90 return 91 92 sections = [("Failed", summary["failed"], "red")] 93- with suppress(TypeError): 94- if Repo(pytestconfig.rootpath).active_branch.name == "dev": 95- sections.append(("Fixed", summary["fixed"], "green")) 96 97 columns = [] 98 for name, all_changes, color in sections: