Closed Milind220 closed 2 years ago
Oh no, I forgot to add information about how to supply your own token 🤦🏼 , because eventually if we use --disable-recording
, we're doing live requests (which will need our AQI token). I think I'll do some writeups right now to inform everyone (including myself) in the future about this; rather than writing the solution in this issue.
Hold my beer, I got this.
What we roughly need is as follows:
--disable-recording
vs relying on mock cassettes.tests/README
into CONTRIBUTING
, which is a more proper and unified place for information.For future visitors to this thread:
If you get vcr.errors.CannotOverwriteExistingCassetteException
when running pytest
, you probably need to use live connection (disable cassette recording) and see if the test passes. That exception is raised when the cassette file is not complete (there is a request in the test function that's not recorded in the cassette file).
If you get Exception: Your API token is invalid
when running pytest --disable-recording
, it's probably because you haven't supplied a working API token to the test suite. In turn, this will make the test suite uses a dummy token, which is obviously not a valid API token.
More about the test suite is explained in CONTRIBUTING.
@Milind220 I just want to confirm, have you checked that the information provided in the PR is sufficient to solve the problem posed in this issue?
@lahdjirayhan Yes, fixed it perfectly! The token was all that was needed.
EDIT: I no longer see the 'not provided a token' issue, but now a different test fails. I ran pytest with recordings disabled here.
I'm having a hard time deciphering what this means. Do I understand correctly that the purpose of this test is to check that incorrectly entered coordinates are handled smoothly? Where did 50.805778 come from?
Description The tests show me that two tests are failing. When I tried @lahdjirayhan 's suggestion of running the following:
pytest tests/test_get_city_forecast.py tests/test_get_coordinate_air.py --disable-recording
Then 16/17 tests failed for really strange reasons.Screenshots of the tests failing are attached below.
To Reproduce Steps to reproduce the behavior:
pytest
in the root directory to see the two originally failing tests.pytest tests/test_get_city_forecast.py tests/test_get_coordinate_air.py --disable-recording
to see 16/17 tests failExpected behavior
--disable-recording
is quite confusing. I expected all tests to pass with this.Screenshots when I ran just
pytest
when I ran
pytest tests/test_get_city_forecast.py tests/test_get_coordinate_air.py --disable-recording
Environment