-
Notifications
You must be signed in to change notification settings - Fork 609
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
Broken reader ut #497
Broken reader ut #497
Conversation
tests/test_paperqa.py
Outdated
@@ -814,6 +814,10 @@ def test_pdf_reader_w_no_match_doc_details(stub_data_dir: Path) -> None: | |||
) | |||
|
|||
|
|||
# default: ['method', 'scheme', 'host', 'port', 'path', 'query'] | |||
# this is the default list + body | |||
# this ensures vcr distinguishes requests with a different body |
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 am tripping up on "distinguishes". Do you mean this cassette will:
- Generate a new one if the body changes
- Not generate a new one if the body changes
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.
Maybe I can word this better, vcr uses these properties to distinguish how requests are different.
If you look through the cassette, many of the stored requests are identical with the exception of the body (identical method, URI, headers, etc)
for example the calls to https://api.openai.com/v1/embeddings and /v1/chat/completion.
Adding body won't create new cassettes; it just helps vcr correctly match the right request with its response.
tests/test_paperqa.py
Outdated
# vcr.VCR default: ('method', 'scheme', 'host', 'port', 'path', 'query') | ||
# this is the default list + body | ||
# Adding body won't create new cassettes; it just helps vcr correctly match the right request with its response. | ||
@pytest.mark.vcr(match_on=["method", "scheme", "host", "port", "path", "query", "body"]) |
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.
# vcr.VCR default: ('method', 'scheme', 'host', 'port', 'path', 'query') | |
# this is the default list + body | |
# Adding body won't create new cassettes; it just helps vcr correctly match the right request with its response. | |
@pytest.mark.vcr(match_on=["method", "scheme", "host", "port", "path", "query", "body"]) | |
# SEE: https://github.com/kevin1024/vcrpy/blob/v6.0.1/vcr/config.py#L43 | |
VCR_DEFAULT_MATCH_ON = 'method', 'scheme', 'host', 'port', 'path', 'query' | |
# Adding body won't create new cassettes; it just helps vcr correctly match the right request with its response. | |
@pytest.mark.vcr(match_on=[*VCR_DEFAULT_MATCH_ON, "body"]) |
And if you could expand your comment to say why we need body here
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.
seems consistent now