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

setup: remove use of setuptools.command.test #64

Merged
merged 1 commit into from
Jul 31, 2024
Merged
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
38 changes: 0 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import os
from setuptools import setup
from setuptools.command.test import test as TestCommand


test_requirements = [
Expand All @@ -25,40 +24,6 @@
for name, reqs in extras_require.items():
extras_require['all'].extend(reqs)

class PyTest(TestCommand):
"""PyTest Test."""

user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]

def initialize_options(self):
"""Init pytest."""
TestCommand.initialize_options(self)
self.pytest_args = []

from ConfigParser import ConfigParser

config = ConfigParser()
config.read('pytest.ini')
self.pytest_args = config.get('pytest', 'addopts').split(' ')

def finalize_options(self):
"""Finalize pytest."""
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

def run_tests(self):
"""Run tests."""
# import here, cause outside the eggs aren't loaded
import pytest
import _pytest.config

pm = _pytest.config.get_plugin_manager()
pm.consider_setuptools_entrypoints()
errno = pytest.main(self.pytest_args)
sys.exit(errno)


g = {}
with open(os.path.join('hepdata_validator', 'version.py'), 'rt') as fp:
exec(fp.read(), g)
Expand Down Expand Up @@ -91,9 +56,6 @@ def run_tests(self):
"pyyaml>=5.4.1",
"requests",
],
test_suite='hepdata_validator.testsuite',
tests_require=test_requirements,
cmdclass={'test': PyTest},
python_requires='>=3.6',
entry_points={
'console_scripts': ['hepdata-validate=hepdata_validator.cli:validate'],
Expand Down