Skip to content

Commit

Permalink
test: monkeypatch some env vars in Predefined Pipelines tests (#7321)
Browse files Browse the repository at this point in the history
* ci: skip some tests if the OPENAI API key is not set

* better idea: monkeypatch the env var
  • Loading branch information
anakin87 committed Mar 7, 2024
1 parent ede768a commit 3dbde84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/core/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 2 additions & 1 deletion test/core/pipeline/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def test_from_predefined(self):
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)

Expand Down

0 comments on commit 3dbde84

Please sign in to comment.