Skip to content

Commit fa63b95

Browse files
committed
Detect tests modification as module scope
1 parent d6638ee commit fa63b95

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests_script.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
logger = logging.getLogger(__name__)
1010

1111
# We ignore .md files and GitHub workflows and app/modules to detect the scope of the changes
12-
IGNORE_PATHS_START = ("app/modules/", ".github/")
12+
IGNORE_PATHS_START = ("app/modules/", "tests/modules/", ".github/")
1313
IGNORE_EXTENSIONS = (".md",)
1414

1515

@@ -30,9 +30,18 @@ def detect_modules(changed_files):
3030
modules = set()
3131
for f in changed_files:
3232
logger.info(f"Changed file: {f}")
33+
# We want to detect changes in app/modules/<module_name>/...
3334
if f.startswith("app/modules/"):
3435
module = f.split("/")[2]
3536
modules.add(module)
37+
# Or the modification of tests in tests/modules/<module_name>/... or tests/modules/test_<module_name>*.py
38+
elif f.startswith("tests/modules/"):
39+
parts = f.split("/")
40+
if parts[2].startswith("test_"):
41+
module = parts[2][5:].split(".")[0].split("_")[0]
42+
else:
43+
module = parts[2]
44+
modules.add(module)
3645
return sorted(modules)
3746

3847

0 commit comments

Comments
 (0)