Skip to content

Commit c2b6d37

Browse files
authored
Drop setup.py test (#2090)
* scripts/run-tests: remove python2 relics * setup.py: drop test For compatibility with setuptools>=72 that remove the test command. See pypa/setuptools#931 * setup.py: remove unused imports
1 parent 75efcca commit c2b6d37

File tree

2 files changed

+4
-40
lines changed

2 files changed

+4
-40
lines changed

Diff for: scripts/run-tests.bat

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
set VENV_PYTHON=%cd%\venv\Scripts\
1010

1111
set COVERAGE_FILE=.coverage.windows.%VERSION%.%FRAMEWORK%.%ASYNCIO%
12-
set IGNORE_PYTHON3_WITH_PYTHON2=
13-
if "%VERSION%" == "2.7" set IGNORE_PYTHON3_WITH_PYTHON2=--ignore-glob="*\py3_*.py"
1412

1513
set PYTEST_JUNIT="--junitxml=.\tests\windows-%VERSION%-%FRAMEWORK%-%ASYNCIO%-python-agent-junit.xml"
1614
if "%ASYNCIO%" == "true" (
17-
%VENV_PYTHON%\python.exe -m pytest %PYTEST_JUNIT% %IGNORE_PYTHON3_WITH_PYTHON2% --cov --cov-context=test --cov-branch --cov-config=setup.cfg -m "not integrationtest" || exit /b 1
15+
%VENV_PYTHON%\python.exe -m pytest %PYTEST_JUNIT% --cov --cov-context=test --cov-branch --cov-config=setup.cfg -m "not integrationtest" || exit /b 1
1816
)
1917
if "%ASYNCIO%" == "false" (
20-
%VENV_PYTHON%\python.exe -m pytest %PYTEST_JUNIT% --ignore-glob="*\asyncio*\*" %IGNORE_PYTHON3_WITH_PYTHON2% --cov --cov-context=test --cov-branch --cov-config=setup.cfg -m "not integrationtest" || exit /b 1
18+
%VENV_PYTHON%\python.exe -m pytest %PYTEST_JUNIT% --ignore-glob="*\asyncio*\*" --cov --cov-context=test --cov-branch --cov-config=setup.cfg -m "not integrationtest" || exit /b 1
2119
)
2220
call %VENV_PYTHON%\python.exe setup.py bdist_wheel

Diff for: setup.py

+2-36
Original file line numberDiff line numberDiff line change
@@ -40,50 +40,16 @@
4040
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4141
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242

43-
# Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error
44-
# in multiprocessing/util.py _exit_function when running `python
45-
# setup.py test` (see
46-
# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
47-
for m in ("multiprocessing", "billiard"):
48-
try:
49-
__import__(m)
50-
except ImportError:
51-
pass
52-
5343
import ast
5444
import codecs
5545
import os
56-
import sys
57-
from distutils.command.build_ext import build_ext
58-
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
5946

6047
import pkg_resources
61-
from setuptools import Extension, setup
62-
from setuptools.command.test import test as TestCommand
48+
from setuptools import setup
6349

6450
pkg_resources.require("setuptools>=39.2")
6551

6652

67-
class PyTest(TestCommand):
68-
user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
69-
70-
def initialize_options(self) -> None:
71-
TestCommand.initialize_options(self)
72-
self.pytest_args = []
73-
74-
def finalize_options(self) -> None:
75-
TestCommand.finalize_options(self)
76-
self.test_args = []
77-
self.test_suite = True
78-
79-
def run_tests(self) -> None:
80-
# import here, cause outside the eggs aren't loaded
81-
import pytest
82-
83-
errno = pytest.main(self.pytest_args)
84-
sys.exit(errno)
85-
86-
8753
def get_version():
8854
"""
8955
Get version without importing from elasticapm. This avoids any side effects
@@ -108,4 +74,4 @@ def get_version():
10874
return "unknown"
10975

11076

111-
setup(cmdclass={"test": PyTest}, version=get_version())
77+
setup(version=get_version())

0 commit comments

Comments
 (0)