aboutsummaryrefslogtreecommitdiffstats
path: root/conftest.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-12-01 09:59:21 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-12-01 09:59:21 -0500
commit413c234459de94766c8c57f10d11ef1599ae6ac0 (patch)
tree51e895f344d3c84e917ea2f95bb101bdd30d15d0 /conftest.py
parentb890d3d27602b6c18985c735a0ba0933232deb82 (diff)
downloadexternal_python_setuptools-413c234459de94766c8c57f10d11ef1599ae6ac0.tar.gz
external_python_setuptools-413c234459de94766c8c57f10d11ef1599ae6ac0.tar.bz2
external_python_setuptools-413c234459de94766c8c57f10d11ef1599ae6ac0.zip
Monkeypatch the 'setuptools.__file__' attribute in test setup to be absolute. Workaround for #852.
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/conftest.py b/conftest.py
index ec8ddd8b..0da92be9 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,7 +1,25 @@
+import os
+
+
pytest_plugins = 'setuptools.tests.fixtures'
+
def pytest_addoption(parser):
parser.addoption(
"--package_name", action="append", default=[],
help="list of package_name to pass to test functions",
)
+
+
+def pytest_configure():
+ _issue_852_workaround()
+
+
+def _issue_852_workaround():
+ """
+ Patch 'setuptools.__file__' with an absolute path
+ for forward compatibility with Python 3.
+ Workaround for https://github.com/pypa/setuptools/issues/852
+ """
+ setuptools = __import__('setuptools')
+ setuptools.__file__ = os.path.abspath(setuptools.__file__)