diff --git a/tests/plugin/test_plugin.py b/tests/plugin/test_plugin.py index 979c0f73f..6a006c88c 100644 --- a/tests/plugin/test_plugin.py +++ b/tests/plugin/test_plugin.py @@ -31,18 +31,13 @@ def app() -> FlaskClient: @patch("cosmos.plugin.open_file") def test_dbt_docs(mock_open_file, monkeypatch, app): - def conf_get(section, key, *args, **kwargs): if section == "cosmos" and key == "dbt_docs_dir": return "path/to/docs/dir" else: return conf.get(section, key, *args, **kwargs) - monkeypatch.setattr( - "cosmos.plugin.conf", - "get", - conf_get - ) + monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get) mock_open_file.return_value = "" @@ -55,18 +50,13 @@ def conf_get(section, key, *args, **kwargs): @patch("cosmos.plugin.open_file") @pytest.mark.parametrize("artifact", ["dbt_docs_index.html", "manifest.json", "catalog.json"]) def test_dbt_docs_artifact(mock_open_file, monkeypatch, app, artifact): - def conf_get(section, key, *args, **kwargs): if section == "cosmos" and key == "dbt_docs_dir": return "path/to/docs/dir" else: return conf.get(section, key, *args, **kwargs) - monkeypatch.setattr( - "cosmos.plugin.conf", - "get", - conf_get - ) + monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get) mock_open_file.return_value = "" response = app.get(f"/cosmos/{artifact}") @@ -76,18 +66,13 @@ def conf_get(section, key, *args, **kwargs): @pytest.mark.parametrize("artifact", ["dbt_docs_index.html", "manifest.json", "catalog.json"]) def test_dbt_docs_artifact_missing(app, artifact, monkeypatch): - def conf_get(section, key, *args, **kwargs): if section == "cosmos": raise AirflowConfigException else: return conf.get(section, key, *args, **kwargs) - monkeypatch.setattr( - "cosmos.plugin.conf", - "get", - conf_get - ) + monkeypatch.setattr("cosmos.plugin.conf", "get", conf_get) response = app.get(f"/cosmos/{artifact}") assert response.status_code == 404