diff --git a/setup.py b/setup.py index 4277edb8f..fe804c384 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,6 @@ setup_requires=["setuptools-scm>2, <4"], # readthedocs needs it extras_require={ "testing": [ - "distro", "pytest >= 3.0.0, <4", "pytest-cov >= 2.5.1, <3", "pytest-mock >= 1.10.0, <2", diff --git a/tests/unit/test_z_cmdline.py b/tests/unit/test_z_cmdline.py index 393aec555..f1c359471 100644 --- a/tests/unit/test_z_cmdline.py +++ b/tests/unit/test_z_cmdline.py @@ -1,11 +1,11 @@ import json import os -import platform import re +import shutil import subprocess import sys +import tempfile -import distro import py import pytest @@ -630,15 +630,24 @@ def test_warning_emitted(cmd, initproj): def _alwayscopy_not_supported(): # This is due to virtualenv bugs with alwayscopy in some platforms # see: https://github.com/pypa/virtualenv/issues/565 - if hasattr(platform, "linux_distribution"): - _dist = distro.linux_distribution(full_distribution_name=False) - (name, version, arch) = _dist - if any((name == "centos" and version[0] == "7", name == "SuSE" and arch == "x86_64")): - return True - return False + supported = True + tmpdir = tempfile.mkdtemp() + try: + with open(os.devnull) as fp: + subprocess.check_call( + [sys.executable, "-m", "virtualenv", "--always-copy", tmpdir], stdout=fp, stderr=fp + ) + except subprocess.CalledProcessError: + supported = False + finally: + shutil.rmtree(tmpdir) + return not supported -@pytest.mark.skipif(_alwayscopy_not_supported(), reason="Platform doesnt support alwayscopy") +alwayscopy_not_supported = _alwayscopy_not_supported() + + +@pytest.mark.skipif(alwayscopy_not_supported, reason="Platform doesnt support alwayscopy") def test_alwayscopy(initproj, cmd): initproj( "example123", diff --git a/tox.ini b/tox.ini index 219ef4d2b..3d0e14cac 100644 --- a/tox.ini +++ b/tox.ini @@ -145,7 +145,7 @@ include_trailing_comma = True force_grid_wrap = 0 line_length = 99 known_first_party = tox,tests -known_third_party = apiclient,distro,docutils,filelock,git,httplib2,oauth2client,packaging,pkg_resources,pluggy,py,pytest,setuptools,six,sphinx,toml +known_third_party = apiclient,docutils,filelock,git,httplib2,oauth2client,packaging,pkg_resources,pluggy,py,pytest,setuptools,six,sphinx,toml [testenv:release] description = do a release, required posarg of the version number