contextily
contextily copied to clipboard
Mark tests that use the network
I know this is a great deal of them, but when building a package there is no network available. It'd be nice to run the other tests at least, and if the tests had pytest markers that would be easy. Many packages provide a network
marker that can be used like pytest -m 'not network'
.
This sounds like a good idea if users find it useful. Personally, I'm almost always online when installing the library, so I hadn't thought about it, but I could see how it has some benefits. This point also brings the question that some tests that currently use the network might not need to use it (e.g. we pull down an image to test a property that could be tested with any, potentially local, image.
On Linux, this is easy to test without having to be off network. You can use unshare
to run a program without network, which you can apply to the pytest
run in the docs:
$ unshare -r -n python3 -m pytest -v tests/ --cov contextily
.
.
.
============ 12 failed, 7 passed, 2 warnings in 3.67 seconds ==============