|
|
|
@ -22,6 +22,10 @@ FILE_HASHES: Dict[str, str] = {}
|
|
|
|
|
ACTUAL_HASHES: Dict[str, str] = {}
|
|
|
|
|
PROCESSED: Set[str] = set()
|
|
|
|
|
|
|
|
|
|
# T1/TT, to be set in screen_recording(), as we do not know it beforehand
|
|
|
|
|
# TODO: it is not the cleanest, we could create a class out of this file
|
|
|
|
|
MODEL = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_test_name(node_id: str) -> str:
|
|
|
|
|
# Test item name is usually function name, but when parametrization is used,
|
|
|
|
@ -103,6 +107,13 @@ def screen_recording(
|
|
|
|
|
) -> Generator[None, None, None]:
|
|
|
|
|
test_ui = request.config.getoption("ui")
|
|
|
|
|
test_name = get_test_name(request.node.nodeid)
|
|
|
|
|
|
|
|
|
|
# Differentiating test names between T1 and TT
|
|
|
|
|
# Making the model global for other functions
|
|
|
|
|
global MODEL
|
|
|
|
|
MODEL = f"T{client.features.model}"
|
|
|
|
|
test_name = f"{MODEL}_{test_name}"
|
|
|
|
|
|
|
|
|
|
screens_test_path = SCREENS_DIR / test_name
|
|
|
|
|
|
|
|
|
|
if test_ui == "record":
|
|
|
|
@ -133,7 +144,11 @@ def screen_recording(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def list_missing() -> Set[str]:
|
|
|
|
|
return set(FILE_HASHES.keys()) - PROCESSED
|
|
|
|
|
# Only listing the ones for the current model
|
|
|
|
|
relevant_cases = {
|
|
|
|
|
case for case in FILE_HASHES.keys() if case.startswith(f"{MODEL}_")
|
|
|
|
|
}
|
|
|
|
|
return relevant_cases - PROCESSED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_fixtures() -> None:
|
|
|
|
@ -153,7 +168,12 @@ def write_fixtures_suggestion(remove_missing: bool) -> None:
|
|
|
|
|
|
|
|
|
|
def _get_fixtures_content(fixtures: Dict[str, str], remove_missing: bool) -> str:
|
|
|
|
|
if remove_missing:
|
|
|
|
|
fixtures = {i: fixtures[i] for i in PROCESSED}
|
|
|
|
|
# Not removing the ones for different model
|
|
|
|
|
nonrelevant_cases = {
|
|
|
|
|
f: h for f, h in FILE_HASHES.items() if not f.startswith(f"{MODEL}_")
|
|
|
|
|
}
|
|
|
|
|
processed_fixtures = {i: fixtures[i] for i in PROCESSED}
|
|
|
|
|
fixtures = {**nonrelevant_cases, **processed_fixtures}
|
|
|
|
|
else:
|
|
|
|
|
fixtures = fixtures
|
|
|
|
|
|
|
|
|
|