Skip to content

Commit

Permalink
setup.py: drop test
Browse files Browse the repository at this point in the history
For compatibility with setuptools>=72 that remove the test command.

See pypa/setuptools#931
  • Loading branch information
xrmx committed Jul 29, 2024
1 parent 175412a commit f38eb17
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -108,4 +77,4 @@ def get_version():
return "unknown"


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

0 comments on commit f38eb17

Please sign in to comment.