Skip to content

Commit c0c088a

Browse files
chore: detect samples tests in nested directories (#372)
Source-Link: googleapis/synthtool@50db768 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978
1 parent 7cd4d6e commit c0c088a

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

language/snippets/api/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def _session_tests(
207207
session: nox.sessions.Session, post_install: Callable = None
208208
) -> None:
209209
# check for presence of tests
210-
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
211-
test_list.extend(glob.glob("tests"))
210+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
211+
"**/test_*.py", recursive=True
212+
)
213+
test_list.extend(glob.glob("**/tests", recursive=True))
212214

213215
if len(test_list) == 0:
214216
print("No tests found, skipping directory.")

language/snippets/classify_text/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def _session_tests(
207207
session: nox.sessions.Session, post_install: Callable = None
208208
) -> None:
209209
# check for presence of tests
210-
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
211-
test_list.extend(glob.glob("tests"))
210+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
211+
"**/test_*.py", recursive=True
212+
)
213+
test_list.extend(glob.glob("**/tests", recursive=True))
212214

213215
if len(test_list) == 0:
214216
print("No tests found, skipping directory.")

language/snippets/cloud-client/v1/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def _session_tests(
207207
session: nox.sessions.Session, post_install: Callable = None
208208
) -> None:
209209
# check for presence of tests
210-
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
211-
test_list.extend(glob.glob("tests"))
210+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
211+
"**/test_*.py", recursive=True
212+
)
213+
test_list.extend(glob.glob("**/tests", recursive=True))
212214

213215
if len(test_list) == 0:
214216
print("No tests found, skipping directory.")

language/snippets/generated-samples/v1/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def _session_tests(
207207
session: nox.sessions.Session, post_install: Callable = None
208208
) -> None:
209209
# check for presence of tests
210-
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
211-
test_list.extend(glob.glob("tests"))
210+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
211+
"**/test_*.py", recursive=True
212+
)
213+
test_list.extend(glob.glob("**/tests", recursive=True))
212214

213215
if len(test_list) == 0:
214216
print("No tests found, skipping directory.")

language/snippets/sentiment/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def _session_tests(
207207
session: nox.sessions.Session, post_install: Callable = None
208208
) -> None:
209209
# check for presence of tests
210-
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
211-
test_list.extend(glob.glob("tests"))
210+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
211+
"**/test_*.py", recursive=True
212+
)
213+
test_list.extend(glob.glob("**/tests", recursive=True))
212214

213215
if len(test_list) == 0:
214216
print("No tests found, skipping directory.")

0 commit comments

Comments
 (0)