KAFKA-17979 Change [pytest] to [tool:pytest] in setup.cfg file (#17740)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
PoAn Yang 2024-11-29 02:26:58 +08:00 committed by GitHub
parent e1ba01d214
commit 1f3f03579c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 11 deletions

View File

@ -161,7 +161,7 @@ https://cwiki.apache.org/confluence/display/KAFKA/tutorial+-+set+up+and+run+Kafk
$ cd kafka/tests
$ virtualenv -p python3 venv
$ . ./venv/bin/activate
$ python3 setup.py develop
$ python3 -m pip install --editable .
$ cd .. # back to base kafka directory
* Run the bootstrap script to set up Vagrant for testing

View File

@ -20,7 +20,7 @@
#
# To ease possible confusion, 'check' instead of 'test' as a prefix for unit tests, since
# many system test files, classes, and methods have 'test' somewhere in the name
[pytest]
[tool:pytest]
testpaths=unit
python_files=check_*.py
python_classes=Check

View File

@ -15,27 +15,24 @@
import re
import sys
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
from setuptools import find_packages, setup, Command
version = ''
with open('kafkatest/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
class PyTest(TestCommand):
class PyTest(Command):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
def run(self):
# import here, cause outside the eggs aren't loaded
import pytest
print(self.pytest_args)
@ -51,8 +48,7 @@ setup(name="kafkatest",
license="apache2.0",
packages=find_packages(),
include_package_data=True,
install_requires=["ducktape==0.12.0", "requests==2.31.0", "psutil==5.7.2"],
tests_require=["pytest", "mock"],
install_requires=["ducktape==0.12.0", "requests==2.31.0", "psutil==5.7.2", "pytest==8.3.3", "mock==5.1.0"],
cmdclass={'test': PyTest},
zip_safe=False
)

View File

@ -17,7 +17,7 @@
#
# To ease possible confusion, prefix muckrake *unit* tests with 'check' instead of 'test', since
# many muckrake files, classes, and methods have 'test' somewhere in the name
[pytest]
[tool:pytest]
python_files=check_*.py
python_classes=Check
python_functions=check_*