Skip to content

Commit

Permalink
use the current python executable to run pytest in build_unit_tests.p…
Browse files Browse the repository at this point in the history
…y, skip .DS_Store directories in testapp creation
  • Loading branch information
anniexiang01 committed Sep 13, 2024
1 parent be1ec68 commit d7e70a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/build_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import argparse
import subprocess
import sys


def RED(text):
Expand Down Expand Up @@ -37,6 +38,11 @@ def CYAN(text):
pytest_directories = []

for app in os.listdir(applications_dir):

if app.startswith(".DS_Store"):
print(f"Skipping application {app}: .DS_Store directory.")
continue

source_dir = os.path.join(applications_dir, app)
test_source_dir = os.path.join(unit_test_dir, f"{app}_test")

Expand Down Expand Up @@ -81,6 +87,6 @@ def CYAN(text):
tests_passed = True
for test_app_dir in pytest_directories:
print(CYAN(f"Running pytest for {test_app_dir}..."))
if subprocess.run(["python", "-m", "pytest"], cwd=test_app_dir).returncode != 0:
if subprocess.run(["sys.executable", "-m", "pytest"], cwd=test_app_dir).returncode != 0:
tests_passed = False
exit(0 if tests_passed else 1)

0 comments on commit d7e70a1

Please sign in to comment.