-
Notifications
You must be signed in to change notification settings - Fork 40
Fixture testdatapath, refactor and unify testdatapath handling #147
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
Conversation
…d usage: - pytest fixture (adding code and info to conftest.py) - compute the testdata_path in only one place - provide used test files as constants
…d usage: - to non test code we shall discuss wether testdata makes sense at all - here i have implemented a small workaround with reusage of conftest.py via a wrapper
|
oops, they should not be in extra subdir. Sorry, my fault. It meant to be /tests only.
yes. I always feel bad when i do suppressions to hide hacks or workarounds like that. Will remove it.
passing explicit is a good idea, let me try that. (explicit is better than implicit ;-) |
- removed dependency on tests aka conftest.py - added explicit arguments for passing in testdata and validation logic
- adopted conftest.py to use only parent instaed of parent.parent
…t the subprocess needs the full environment (PATH, PYTHONPATH, system libraries, etc.) to import Python modules correctly. Fix: Changed the fixture to inherit the full parent environment (dict(os.environ)) instead of building a minimal one.
| "Either --database or --podcast-index must be specified. " | ||
| "Use --podcast-index to specify the path to podcast index files " | ||
| f"(e.g., '{_EXAMPLE_PODCAST_INDEX}')." |
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.
Oh, excellent. In practice the server almost always should use --database, which should be pre-filled by running one of the ingest tools.
| parser.add_argument( | ||
| "-p", | ||
| "--podcast-index", | ||
| type=str, | ||
| default=None, | ||
| help="Path to podcast index files (excluding '_data.json' suffix), " | ||
| f"e.g., '{_EXAMPLE_PODCAST_INDEX}'", |
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.
At some point in the future we should be able to remove --podcast-index altogether, but not yet (and the test uses it).
tests/test_mcp_server.py
Outdated
| # Parse response (it should be JSON with success, answer, time_used) | ||
| import json | ||
|
|
||
| print(f"Response text: {response_text}") |
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.
Do you still need this debug print?
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.
removed
| # Pass through environment variables needed for authentication | ||
| # otherwise this test will fail in the CI on Windows only | ||
| if not (server_params.env) is None: | ||
| server_params.env.update( | ||
| { | ||
| k: v | ||
| for k, v in os.environ.items() | ||
| if k.startswith(("AZURE_", "OPENAI_")) or k in ("CREDENTIALS_JSON",) | ||
| } | ||
| ) | ||
|
|
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.
I hope that you're right that we don't need this any more.
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.
Ups, sorry. This is still necessary for ci in windows. I will put it pack.
…rver, or windows ci - removed debug output
a possible solution for #146
for details/question of implementation approach, please check #146