-
Notifications
You must be signed in to change notification settings - Fork 2
Fix tests that don't require an API key #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba2458d
5c2b1d1
4fa0448
7c71da0
116696f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,8 @@ def _validate_llm_config(config: LLMConfig) -> None: | |
|
|
||
|
|
||
| @pytest.mark.parametrize("path", example_llm_config_paths, ids=[path.name for path in example_llm_config_paths]) | ||
| def test_example_llm_configs(path: Path) -> None: | ||
| def test_example_llm_configs(path: Path, monkeypatch: pytest.MonkeyPatch) -> None: | ||
| monkeypatch.setenv("OPENAI_API_KEY", "test_key") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we had a problem with monkeypatch. It overwrited the real API KEY for smoke tests.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the documentation:
I believe the problem before was with
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About autouse -
I'm not sure it should work for tests in different files, but it was the case.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really I can't reproduce this problem with monkeypatch + autouse. Probably I'm missing some details.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kosstbarz I figured it out. The problem was in I will make a PR (#141) to remove |
||
| config = LLMConfig.from_yaml(path) | ||
| _validate_llm_config(config) | ||
|
|
||
|
|
@@ -39,7 +40,8 @@ def test_example_llm_configs(path: Path) -> None: | |
| LLMConfigDirectory.list_all(), | ||
| ids=[c.name for c in LLMConfigDirectory.list_all()], | ||
| ) | ||
| def test_llm_config_directory(config: LLMConfig) -> None: | ||
| def test_llm_config_directory(config: LLMConfig, monkeypatch: pytest.MonkeyPatch) -> None: | ||
| monkeypatch.setenv("OPENAI_API_KEY", "test_key") | ||
| _validate_llm_config(config) | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you delete it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion it is a useless section that will be constantly out of date (as it already is - there is no
agentsdir). I predicted that would happen here #76 (comment).