mirror of https://github.com/apache/kafka.git
KAFKA-17979 Change [pytest] to [tool:pytest] in setup.cfg file (#17740)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
e1ba01d214
commit
1f3f03579c
|
@ -161,7 +161,7 @@ https://cwiki.apache.org/confluence/display/KAFKA/tutorial+-+set+up+and+run+Kafk
|
||||||
$ cd kafka/tests
|
$ cd kafka/tests
|
||||||
$ virtualenv -p python3 venv
|
$ virtualenv -p python3 venv
|
||||||
$ . ./venv/bin/activate
|
$ . ./venv/bin/activate
|
||||||
$ python3 setup.py develop
|
$ python3 -m pip install --editable .
|
||||||
$ cd .. # back to base kafka directory
|
$ cd .. # back to base kafka directory
|
||||||
|
|
||||||
* Run the bootstrap script to set up Vagrant for testing
|
* Run the bootstrap script to set up Vagrant for testing
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#
|
#
|
||||||
# To ease possible confusion, 'check' instead of 'test' as a prefix for unit tests, since
|
# 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
|
# many system test files, classes, and methods have 'test' somewhere in the name
|
||||||
[pytest]
|
[tool:pytest]
|
||||||
testpaths=unit
|
testpaths=unit
|
||||||
python_files=check_*.py
|
python_files=check_*.py
|
||||||
python_classes=Check
|
python_classes=Check
|
||||||
|
|
|
@ -15,27 +15,24 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup, Command
|
||||||
from setuptools.command.test import test as TestCommand
|
|
||||||
|
|
||||||
version = ''
|
version = ''
|
||||||
with open('kafkatest/__init__.py', 'r') as fd:
|
with open('kafkatest/__init__.py', 'r') as fd:
|
||||||
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
|
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")]
|
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
TestCommand.initialize_options(self)
|
|
||||||
self.pytest_args = []
|
self.pytest_args = []
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
TestCommand.finalize_options(self)
|
|
||||||
self.test_args = []
|
self.test_args = []
|
||||||
self.test_suite = True
|
self.test_suite = True
|
||||||
|
|
||||||
def run_tests(self):
|
def run(self):
|
||||||
# import here, cause outside the eggs aren't loaded
|
# import here, cause outside the eggs aren't loaded
|
||||||
import pytest
|
import pytest
|
||||||
print(self.pytest_args)
|
print(self.pytest_args)
|
||||||
|
@ -51,8 +48,7 @@ setup(name="kafkatest",
|
||||||
license="apache2.0",
|
license="apache2.0",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=["ducktape==0.12.0", "requests==2.31.0", "psutil==5.7.2"],
|
install_requires=["ducktape==0.12.0", "requests==2.31.0", "psutil==5.7.2", "pytest==8.3.3", "mock==5.1.0"],
|
||||||
tests_require=["pytest", "mock"],
|
|
||||||
cmdclass={'test': PyTest},
|
cmdclass={'test': PyTest},
|
||||||
zip_safe=False
|
zip_safe=False
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#
|
#
|
||||||
# To ease possible confusion, prefix muckrake *unit* tests with 'check' instead of 'test', since
|
# 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
|
# many muckrake files, classes, and methods have 'test' somewhere in the name
|
||||||
[pytest]
|
[tool:pytest]
|
||||||
python_files=check_*.py
|
python_files=check_*.py
|
||||||
python_classes=Check
|
python_classes=Check
|
||||||
python_functions=check_*
|
python_functions=check_*
|
||||||
|
|
Loading…
Reference in New Issue