Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop setup.py test #2090

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions scripts/run-tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 2 additions & 36 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,50 +40,16 @@
# 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
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.command.test import test as TestCommand
from setuptools import setup

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
Expand All @@ -108,4 +74,4 @@ def get_version():
return "unknown"


setup(cmdclass={"test": PyTest}, version=get_version())
setup(version=get_version())
Loading