From 03289f6ec6e45164bd14c42a149110eb89fdb8c3 Mon Sep 17 00:00:00 2001 From: Manolis Papadakis Date: Wed, 10 Aug 2022 17:30:38 -0700 Subject: [PATCH 1/2] Ensure test.py --use flag fully overrides USE_* envvars --- tests/_utils/config.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/_utils/config.py b/tests/_utils/config.py index c873b2a3b..34c810cf0 100644 --- a/tests/_utils/config.py +++ b/tests/_utils/config.py @@ -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: From 9ff907a88cf6426815ed351a77797b31847b0549 Mon Sep 17 00:00:00 2001 From: Manolis Papadakis Date: Fri, 12 Aug 2022 18:58:43 -0700 Subject: [PATCH 2/2] Update a test-tools unit test --- tests/_utils/tests/test_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_utils/tests/test_config.py b/tests/_utils/tests/test_config.py index 20b398b7f..a8d4ffe17 100644 --- a/tests/_utils/tests/test_config.py +++ b/tests/_utils/tests/test_config.py @@ -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: