Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-suites-dir: Allow multiple dirs with OS path separator #155

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ optional arguments:
set the directory where decoder outputs will be stored
-ne, --no-emoji set to use plain text instead of emojis
-tsd TEST_SUITES_DIR, --test-suites-dir TEST_SUITES_DIR
set the directory where test suite will be read from
set directory where test suite will be read from, multiple directories are supported with OS path separator (:)

subcommands:
{list,l,run,r,download,d,reference,f}
Expand Down
9 changes: 7 additions & 2 deletions fluster/fluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import os
import os.path
from functools import lru_cache
from typing import List, Dict, Any, Tuple, Optional
from typing import List, Dict, Any, Tuple, Optional, Iterator
import sys
from enum import Enum
from shutil import rmtree
Expand Down Expand Up @@ -161,9 +161,14 @@ def __init__(
f" * output_dir: {self.output_dir}"
)

def _walk_test_suite_dir(self) -> Iterator[Tuple[str, List[str], List[str]]]:
for test_suite_dir in self.test_suites_dir.split(os.pathsep):
for root, dirnames, files in os.walk(test_suite_dir):
yield (root, dirnames, files)

@lru_cache(maxsize=128)
def _load_test_suites(self) -> None:
for root, _, files in os.walk(self.test_suites_dir):
for root, _, files in self._walk_test_suite_dir():
for file in files:
if os.path.splitext(file)[1] == ".json":
try:
Expand Down
5 changes: 4 additions & 1 deletion fluster/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ def _create_parser(self) -> argparse.ArgumentParser:
parser.add_argument(
"-tsd",
"--test-suites-dir",
help="set the directory where test suite will be read from",
help=(
"set directory where test suite will be read from, "
f"multiple directories are supported with OS path separator ({os.pathsep})"
),
default=self.test_suites_dir,
)
subparsers = parser.add_subparsers(title="subcommands")
Expand Down