From b890d3d27602b6c18985c735a0ba0933232deb82 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Dec 2016 09:54:40 -0500 Subject: Clean up conftest.py --- conftest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'conftest.py') diff --git a/conftest.py b/conftest.py index 47a5d888..ec8ddd8b 100644 --- a/conftest.py +++ b/conftest.py @@ -1,8 +1,7 @@ -import pytest - 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") - + parser.addoption( + "--package_name", action="append", default=[], + help="list of package_name to pass to test functions", + ) -- cgit v1.2.1 From 413c234459de94766c8c57f10d11ef1599ae6ac0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Dec 2016 09:59:21 -0500 Subject: Monkeypatch the 'setuptools.__file__' attribute in test setup to be absolute. Workaround for #852. --- conftest.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'conftest.py') 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__) -- cgit v1.2.1 From 5c9406987aacf17d9c004aa1456797e0044306e5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 10 Dec 2016 14:20:23 -0500 Subject: Use py.test to launch pytest, rather than python -m test, preventing the empty path from being added to sys.path per pytest-dev/pytest#2104. Fixes #852. Also use 'usedevelop' as the setuptools.tests.fixtures aren't available in a standard install. --- conftest.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'conftest.py') diff --git a/conftest.py b/conftest.py index 0da92be9..3cccfe1a 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,3 @@ -import os - - pytest_plugins = 'setuptools.tests.fixtures' @@ -9,17 +6,3 @@ def pytest_addoption(parser): "--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__) -- cgit v1.2.1