Failing test
EdwardBetts opened this issue · 4 comments
One of the tests is failing for me. I'm testing xyzservices 2022.9.0
Here is the test output.
$ python3 -mpytest -x -v
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.7, pytest-7.1.2, pluggy-1.0.0+repack -- /usr/bin/python3
cachedir: .pytest_cache
benchmark: 3.2.2 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/edward/src/debian/python-modules/xyzservices/.hypothesis/examples')
rootdir: /home/edward/src/debian/python-modules/xyzservices, configfile: pytest.ini
plugins: benchmark-3.2.2, astropy-header-0.2.2, forked-1.4.0, flaky-3.7.0, hypothesis-6.36.0, doctestplus-0.12.1, kgb-7.1.1, repeat-0.9.1, django-4.5.2, timeout-2.1.0, anyio-3.6.1, pylama-7.4.3, cov-4.0.0, tornasync-0.6.0.post2, remotedata-0.3.3, mock-3.8.2, requests-mock-1.9.3, xdist-2.5.0, asyncio-0.19.0
asyncio: mode=strict
collected 451 items
xyzservices/tests/test_lib.py::test_expect_name_url_attribution PASSED [ 0%]
xyzservices/tests/test_lib.py::test_build_url PASSED [ 0%]
xyzservices/tests/test_lib.py::test_requires_token PASSED [ 0%]
xyzservices/tests/test_lib.py::test_html_repr PASSED [ 0%]
xyzservices/tests/test_lib.py::test_copy PASSED [ 1%]
xyzservices/tests/test_lib.py::test_callable FAILED [ 1%]
========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________________________________ test_callable _______________________________________________________________________________________
def test_callable():
# only testing the callable functionality to override a keyword, as we
# cannot test the actual providers that need an API key
updated_provider = xyz.GeoportailFrance.plan(apikey="mykey")
assert isinstance(updated_provider, TileProvider)
assert "url" in updated_provider
assert updated_provider["apikey"] == "mykey"
# check that original provider dict is not modified
> assert xyz.GeoportailFrance.plan["apikey"] == "essentiels"
E AssertionError: assert 'choisirgeoportail' == 'essentiels'
E - essentiels
E + choisirgeoportail
xyzservices/tests/test_lib.py:189: AssertionError
================================================================================== short test summary info ==================================================================================
FAILED xyzservices/tests/test_lib.py::test_callable - AssertionError: assert 'choisirgeoportail' == 'essentiels'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 1 failed, 5 passed in 0.34s ================================================================================
$
Hmm, that looks like some conflict between versions of the underlying JSON. choisirgeoportail
was used prior 2022.9.0 and is now replaced by essentiels
. It seems that an update went wrong somehow.
What do number you get sing this snippet?
import xyzservices.providers as xyz
len(xyz.flatten())
It should be 498 if the JSON is correctly loaded.
Also, pytest should collect 972 items, not 451. Something is weird there.
When I run the snippet I get 498.
I would try to reinstall the library, I am not sure what is causing this apart from the old JSON loaded by the new version.
I will close it for now as I cannot reproduce it and it seems to be a mismatch between installed JSON and package version. We can reopen if it comes back.