Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Don't access internet during tests. #13782

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

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 28, 2019

The tests that style.use() and imread() support urls can just use local
urls (file://); this avoids failing the tests when downloading the
gist fails due to a flaky connection.

Since RFC8089 file: urls don't necessarily start with two slashes
anymore (https://tools.ietf.org/html/rfc8089#appendix-A).

(If we really want to test https we could use http.server to spin up a local server but that seems overkill.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Copy link
Member

@WeatherGod WeatherGod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly approve. I do wonder if we should leave the --no-network option in tests.py and have it emit a deprecation message, but I am not going to make a big deal about it.

@timhoffm
Copy link
Member

Basically good. However this PR breaks Appveyor (something about the generated style file not found).

@anntzer
Copy link
Contributor Author

anntzer commented Mar 29, 2019

I just needed to understand how file:/// uris work on Windows... should be fixed now.
As it turns out this picked up another issue which is that we didn't support file:/path/... and required file:///path/...` instead, contrary to https://tools.ietf.org/html/rfc8089#appendix-A. Fixed as well (edited commit message).

@dstansby dstansby added this to the v3.2.0 milestone Mar 29, 2019
@anntzer
Copy link
Contributor Author

anntzer commented Apr 1, 2019

So (unsurprisingly...) this exposed a bug where imread(), when passed in an object constructed with urlopen("file:///..."), would always go through Pillow to open the file (basically, because urlopen("file:///...") returns an object with a .name attribute). The Appveyor tests would then fail because Pillow is not installed.
Should be fixed now...

@anntzer anntzer force-pushed the networklesstests branch from 8d981c2 to cbc4172 Compare April 1, 2019 12:17
@anntzer
Copy link
Contributor Author

anntzer commented Apr 1, 2019

Good to go now :)

@@ -39,17 +39,10 @@
from matplotlib import test

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--no-network', action='store_true',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to leave this for the sake of anyone who needs to suppress network access and test more than one version of matplotlib?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can always use -m 'not network'; mentioned this in changelog.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modulo ether restoring the cli flag or adding an API changes note

The tests that style.use() and imread() support urls can just use local
urls (`file:`); this avoids failing the tests when downloading the
gist fails due to a flaky connection.

Since RFC8089 file: urls don't necessarily start with two slashes
anymore.
@anntzer anntzer force-pushed the networklesstests branch from cbc4172 to 422d1ae Compare April 1, 2019 20:46
@WeatherGod WeatherGod merged commit 4f41946 into matplotlib:master Apr 3, 2019
@anntzer anntzer deleted the networklesstests branch April 3, 2019 14:13
@tacaswell
Copy link
Member

attn @sandrotosi

@sandrotosi
Copy link
Contributor

thanks for the heads up! i dont think this will be a problem, as in Debian we already split the packages for the 2.x and 3.x releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants