From 68b3a42d7d273a57b7c662af167b50255c19fbb7 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 29 Jul 2024 11:16:11 +0200 Subject: [PATCH 1/3] scripts/run-tests: remove python2 relics --- scripts/run-tests.bat | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/run-tests.bat b/scripts/run-tests.bat index 0fce63000..f17e57d9c 100644 --- a/scripts/run-tests.bat +++ b/scripts/run-tests.bat @@ -9,14 +9,12 @@ set VENV_PYTHON=%cd%\venv\Scripts\ set COVERAGE_FILE=.coverage.windows.%VERSION%.%FRAMEWORK%.%ASYNCIO% -set IGNORE_PYTHON3_WITH_PYTHON2= -if "%VERSION%" == "2.7" set IGNORE_PYTHON3_WITH_PYTHON2=--ignore-glob="*\py3_*.py" set PYTEST_JUNIT="--junitxml=.\tests\windows-%VERSION%-%FRAMEWORK%-%ASYNCIO%-python-agent-junit.xml" if "%ASYNCIO%" == "true" ( - %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 + %VENV_PYTHON%\python.exe -m pytest %PYTEST_JUNIT% --cov --cov-context=test --cov-branch --cov-config=setup.cfg -m "not integrationtest" || exit /b 1 ) if "%ASYNCIO%" == "false" ( - %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 + %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 ) call %VENV_PYTHON%\python.exe setup.py bdist_wheel From 8a90cd58aa11489778716d9cc3c048b25d813b11 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 29 Jul 2024 11:26:45 +0200 Subject: [PATCH 2/3] setup.py: drop test For compatibility with setuptools>=72 that remove the test command. See https://github.com/pypa/setuptools/issues/931 --- setup.py | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/setup.py b/setup.py index a88cdeb5b..9dbed8a38 100644 --- a/setup.py +++ b/setup.py @@ -40,16 +40,6 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error -# in multiprocessing/util.py _exit_function when running `python -# setup.py test` (see -# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) -for m in ("multiprocessing", "billiard"): - try: - __import__(m) - except ImportError: - pass - import ast import codecs import os @@ -59,31 +49,10 @@ import pkg_resources from setuptools import Extension, setup -from setuptools.command.test import test as TestCommand pkg_resources.require("setuptools>=39.2") -class PyTest(TestCommand): - user_options = [("pytest-args=", "a", "Arguments to pass to py.test")] - - def initialize_options(self) -> None: - TestCommand.initialize_options(self) - self.pytest_args = [] - - def finalize_options(self) -> None: - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self) -> None: - # import here, cause outside the eggs aren't loaded - import pytest - - errno = pytest.main(self.pytest_args) - sys.exit(errno) - - def get_version(): """ Get version without importing from elasticapm. This avoids any side effects @@ -108,4 +77,4 @@ def get_version(): return "unknown" -setup(cmdclass={"test": PyTest}, version=get_version()) +setup(version=get_version()) From 108f4951b357635f829f9283f3b84080994ab39e Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 29 Jul 2024 15:16:43 +0200 Subject: [PATCH 3/3] setup.py: remove unused imports --- setup.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 9dbed8a38..5dbb8f643 100644 --- a/setup.py +++ b/setup.py @@ -43,12 +43,9 @@ import ast import codecs import os -import sys -from distutils.command.build_ext import build_ext -from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError import pkg_resources -from setuptools import Extension, setup +from setuptools import setup pkg_resources.require("setuptools>=39.2")