From 4e3a4b7023ebf108f5a59aa14c4b9d85af7b0ec9 Mon Sep 17 00:00:00 2001 From: Justin Mahlik Date: Thu, 10 Oct 2024 16:27:42 -0500 Subject: [PATCH] fix: remove deprecated test command from setup.py See https://github.com/pypa/setuptools/issues/4519 * Remove tests_require and add a test extra * Add extra for ecos since it will not be installed by default https://www.cvxpy.org/updates/index.html#ecos-deprecation --- setup.py | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/setup.py b/setup.py index 63ba0a2..c702fde 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,8 @@ #!/usr/bin/env python import os -import sys from setuptools import find_packages, setup, Command -from setuptools.command.test import test as TestCommand - long_description = ''' **RoPWR** is a library written in Python implementing several mathematical @@ -31,20 +28,6 @@ def run(self): os.system('rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info') -# test suites -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = [] - - def run_tests(self): - # import here, because outside the eggs aren't loaded - import pytest - errcode = pytest.main(self.test_args) - sys.exit(errcode) - - # install requirements install_requires = [ 'cvxpy>=1.1.14', @@ -54,10 +37,10 @@ def run_tests(self): ] # test requirements -tests_require = [ - 'pytest', - 'coverage' -] +extras_require = { + 'test': ['pytest', 'coverage'], + 'ecos': ['ecos'], +} # Read version file @@ -78,10 +61,10 @@ def run_tests(self): include_package_data=True, license="Apache Licence 2.0", url="https://github.com/guillermo-navas-palencia/ropwr", - cmdclass={'clean': CleanCommand, 'test': PyTest}, + cmdclass={'clean': CleanCommand}, python_requires='>=3.7', install_requires=install_requires, - tests_require=tests_require, + extras_require=extras_require, classifiers=[ 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Software Development :: Libraries',