contextily icon indicating copy to clipboard operation
contextily copied to clipboard

Mark tests that use the network

Open QuLogic opened this issue 5 years ago • 2 comments

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'.

QuLogic avatar Feb 22 '20 06:02 QuLogic

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.

darribas avatar Feb 23 '20 21:02 darribas

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 ==============

QuLogic avatar Mar 05 '20 08:03 QuLogic