Skip to content

Commit

Permalink
use listdir instead of glob
Browse files Browse the repository at this point in the history
  • Loading branch information
sirutBuasai committed Oct 31, 2024
1 parent 22bd6ca commit 02e6294
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/dlc_tests/sanity/quick_checks/test_sanity_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,23 @@ def test_sanity_fixture_api():
sanity_test_path = os.path.join(repository_path, "test", "dlc_tests", "sanity")
LOGGER.info(f"Test directory: {sanity_test_path}")

files = glob.glob("test_*.py", root_dir=sanity_test_path)
files = [file for file in os.listdir(sanity_test_path) if re.match(r"test_(.*)\.py", file)]

for file in files:
nodes = subprocess.run(["python", "-m", "pytest", str(file), "--collect-only"])
nodes = pytest.main([str(file), "--collect-only"])
# nodes = subprocess.run(["python", "-m", "pytest", str(file), "--collect-only"])
LOGGER.info(nodes)


# if __name__ == "__main__":
# repository_path = os.getcwd().split("/test/")[0]
#
# # Look only at test files within the sanity test directory
# sanity_test_path = os.path.join(repository_path, "test", "dlc_tests", "sanity")
# LOGGER.info(f"Test directory: {sanity_test_path}")
#
# files = [file for file in os.listdir(sanity_test_path) if re.match(r"test_(.*)\.py", file)]
# for file in files:
# nodes = pytest.main([str(file), "--collect-only"])
# # nodes = subprocess.run(["python", "-m", "pytest", str(file), "--collect-only"])
# LOGGER.info(nodes)

0 comments on commit 02e6294

Please sign in to comment.