Skip to content

Commit 2a9d0a3

Browse files
authored
fix: poly test for test modules with same name (#331)
* refactor(poly test): explicit name to avoid confusion with existing brick name * bump Poetry plugin to 1.37.1 * bump CLI to 1.27.1
1 parent 72ebc08 commit 2a9d0a3

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

components/polylith/commands/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def get_imported_bricks_in_tests(
88
root: Path, ns: str, tag_name: Union[str, None], theme: str
99
) -> Set[str]:
1010
files = test.get_changed_files(root, tag_name)
11-
imports = test.get_brick_imports_in_tests(root, ns, theme, files)
11+
brick_imports = test.get_brick_imports_in_tests(root, ns, theme, files)
1212

13-
return set().union(*imports.values())
13+
return set().union(*brick_imports.values())
1414

1515

1616
def extract_brick_names(bricks_data: List[dict], imported_bricks: Set[str]) -> Set[str]:

components/polylith/test/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from typing import List, Union
33

4-
from polylith import check, diff
4+
from polylith import check, diff, imports
55

66

77
def is_test(root: Path, ns: str, path: Path, theme: str) -> bool:
@@ -30,4 +30,8 @@ def get_brick_imports_in_tests(
3030
) -> dict:
3131
matched = {f for f in files if is_test(root, ns, f, theme)}
3232

33-
return check.collect.extract_bricks(matched, ns)
33+
listed_imports = [imports.list_imports(m) for m in matched]
34+
35+
all_imports = {k: v for k, v in enumerate(listed_imports)}
36+
37+
return check.grouping.extract_brick_imports(all_imports, ns)

projects/poetry_polylith_plugin/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "poetry-polylith-plugin"
3-
version = "1.37.0"
3+
version = "1.37.1"
44
description = "A Poetry plugin that adds tooling support for the Polylith Architecture"
55
authors = ["David Vujic"]
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

projects/polylith_cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "polylith-cli"
3-
version = "1.27.0"
3+
version = "1.27.1"
44
description = "Python tooling support for the Polylith Architecture"
55
authors = ['David Vujic']
66
homepage = "https://davidvujic.github.io/python-polylith-docs/"

0 commit comments

Comments
 (0)