test: monkeypatch some env vars in Predefined Pipelines tests (#7321)

* ci: skip some tests if the OPENAI API key is not set

* better idea: monkeypatch the env var
This commit is contained in:
Stefano Fiorucci 2024-03-07 08:52:25 +01:00 committed by GitHub
parent ede768a517
commit 3dbde84a28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -700,7 +700,8 @@ def test_describe_no_outputs():
assert p.outputs() == {}
def test_from_template():
def test_from_template(monkeypatch):
monkeypatch.setenv("OPENAI_API_KEY", "fake_key")
pipe = Pipeline.from_template(PredefinedPipeline.INDEXING)
assert pipe.get_component("cleaner")

View File

@ -44,7 +44,8 @@ class TestPipelineTemplate:
assert len(tpl.template_content)
# Building a pipeline directly using all default components specified in a predefined or custom template.
def test_build_pipeline_with_default_components(self):
def test_build_pipeline_with_default_components(self, monkeypatch):
monkeypatch.setenv("OPENAI_API_KEY", "fake_key")
rendered = PipelineTemplate.from_predefined(PredefinedPipeline.INDEXING).render()
pipeline = Pipeline.loads(rendered)