diff --git a/tests/hydra/my_app.py b/tests/hydra/my_app.py index dca19dc0bdc1..3ee28f98d788 100644 --- a/tests/hydra/my_app.py +++ b/tests/hydra/my_app.py @@ -38,6 +38,7 @@ def my_app(cfg): print(OmegaConf.to_yaml(cfg)) # Get dataset_name. dataset_name = cfg.dataset_name + assert isinstance(dataset_name, str), f"dataset_name must be a str, got {type(dataset_name)}" if __name__ == "__main__": diff --git a/tests/hydra/test_hydra_runner.py b/tests/hydra/test_hydra_runner.py index 11c3f3dc6601..2b05a8c8b070 100644 --- a/tests/hydra/test_hydra_runner.py +++ b/tests/hydra/test_hydra_runner.py @@ -78,6 +78,16 @@ def test_config2_invalid(self): # Run the call as subprocess. subprocess.check_call(call, shell=True, stdout=sys.stdout, stderr=sys.stdout) + @pytest.mark.unit + def test_passthrough_config(self): + """Test calling my_app directly with a DictConfig (cfg_passthrough path).""" + from omegaconf import OmegaConf + + from tests.hydra.my_app import my_app + + cfg = OmegaConf.create({"dataset_name": "passthrough_test"}) + my_app(cfg) + @pytest.mark.integration def test_config2_filepath_schema(self): """ "Test injection of valid config2 - using namepath with schema is prohibited."""