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

Ensure test.py --use flag fully overrides USE_* envvars #524

Merged
merged 2 commits into from
Aug 15, 2022
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
15 changes: 8 additions & 7 deletions tests/_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ def legate_path(self) -> Path:
return self.legate_dir / "bin" / "legate"

def _compute_features(self, args: Namespace) -> tuple[FeatureType, ...]:
args_features = args.features or []
computed = []
for feature in FEATURES:
if feature in args_features:
computed.append(feature)
elif os.environ.get(f"USE_{feature.upper()}", None) == "1":
computed.append(feature)
if args.features is not None:
computed = args.features
else:
computed = [
feature
for feature in FEATURES
if os.environ.get(f"USE_{feature.upper()}", None) == "1"
]

# if nothing is specified any other way, at least run CPU stage
if len(computed) == 0:
Expand Down
2 changes: 1 addition & 1 deletion tests/_utils/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_env_features(

# also test with a --use value provided
c = m.Config(["test.py", "--use", "cuda"])
assert set(c.features) == {"cuda", feature}
assert set(c.features) == {"cuda"}

@pytest.mark.parametrize("feature", FEATURES)
def test_cmd_features(self, feature: str) -> None:
Expand Down