[gnome-keysign: 3/11] setup: replace nose with pytest
- From: Tobias Mueller <tobiasmue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keysign: 3/11] setup: replace nose with pytest
- Date: Thu, 15 Sep 2022 10:12:04 +0000 (UTC)
commit 2994a269979d23d8e114a588c6f74381ef54b16e
Author: Tobias Mueller <muelli cryptobitch de>
Date: Wed Sep 14 21:39:30 2022 +0200
setup: replace nose with pytest
It seems to be discouraged to specify a test runner in setup.py. I
haven't fully understood why, but it seems to be related to the
dependencies being pulled. Or so.
Since I don't know what the Python equivalent of "make test" is, I keep
providing a test command. You are still free to not use that.
The tests run with a simple invocation of "pytest". If you want to see
the logging, "pytest --log-cli-level=DEBUG" will do. To test a specific
test, run "pytest tests/test_bluetooth.py::test_bt_wrong_hmac"
setup.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/setup.py b/setup.py
index f8aa195..6d031c5 100644
--- a/setup.py
+++ b/setup.py
@@ -59,17 +59,16 @@ class InstallWithCompile(install):
install.run(self)
-# Inspired by the example at https://pytest.org/latest/goodpractises.html
-class NoseTestCommand(TestCommand):
+class PytestTestCommand(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
- # Run nose ensuring that argv simulates running nosetests directly
- import nose
- nose.run_exit(argv=['nosetests' , 'tests'])
+ print ("We're just running pytest...", file=sys.stderr)
+ import subprocess
+ subprocess.call(['pytest'])
setup(
@@ -139,7 +138,8 @@ setup(
"BabelGladeExtractor",
],
tests_require=[
- "nose",
+ "pytest",
+ "pytest_twisted",
"tox",
"pycodestyle",
"pylint",
@@ -199,7 +199,6 @@ setup(
cmdclass={
'build': BuildWithCompile,
#'install': InstallWithCompile,
- 'test': NoseTestCommand,
+ 'test': PytestTestCommand,
},
- # test_suite = 'nose.collector',
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]