diff --git a/pytest.ini b/pytest.ini index ff9847d3..61b492e3 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,23 @@ addopts = -ra -n auto testpaths = tests ; Add vendor and patched in addition to the default list of ignored dirs -norecursedirs = .* build dist CVS _darcs {arch} *.egg vendor patched news tasks docs tests/test_artifacts +; Additionally, ignore tasks, news, test subdirectories and peeps directory +norecursedirs = + .* build + dist + CVS + _darcs + {arch} + *.egg + vendor + patched + news + tasks + docs + tests/test_artifacts + tests/pytest-pypi + tests/pypi + peeps filterwarnings = ignore::DeprecationWarning ignore::PendingDeprecationWarning diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index b7c4784b..ac99418d 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -23,16 +23,24 @@ warnings.simplefilter("default", category=ResourceWarning) HAS_WARNED_GITHUB = False +def try_internet(url="http://httpbin.org/ip", timeout=1.5): + resp = requests.get(url, timeout=timeout) + resp.raise_for_status() + + def check_internet(): - try: - # Kenneth represents the Internet LGTM. - resp = requests.get('http://httpbin.org/ip', timeout=1.0) - resp.raise_for_status() - except Exception: - warnings.warn('Cannot connect to HTTPBin...', RuntimeWarning) - warnings.warn('Will skip tests requiring Internet', RuntimeWarning) - return False - return True + has_internet = False + for url in ("http://httpbin.org/ip", "http://clients3.google.com/generate_204"): + try: + try_internet(url) + except Exception: + warnings.warn( + "Failed connecting to internet: {0}".format(url), RuntimeWarning + ) + else: + has_internet = True + break + return has_internet def check_github_ssh():