swagger-codegen
swagger-codegen copied to clipboard
[python] drop nose usage for unittest
Description
nose component[1] is not maintainer, last commit is 7 years old(!).
It somehow managed to work so far(?) it is time to retire.
For a simple python language replacing the nose with pytest in generated test-requirements.txt and tox.ini working without additional change.
[1] https://github.com/nose-devs/nose
Swagger-codegen version
2.4.28
Swagger declaration file content or url
petstore
Command line used for generation
java -jar swagger-codegen-cli.jar generate -l python -i swagger.json -o out1
Steps to reproduce
$ python3 -V
Python 3.10.4
$ tox -e py3
<snip>
File "/out1/.tox/py3/lib/python3.10/site-packages/nose/suite.py", line 106, in _set_tests
if isinstance(tests, collections.Callable) and not is_suite:
AttributeError: module 'collections' has no attribute 'Callable'
Suggest a fix/enhancement
Apply:
diff --git a/test-requirements.txt b/test-requirements.txt
index 2702246..0ebd529 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,5 +1,5 @@
coverage>=4.0.3
-nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
+pytest
randomize>=0.13
diff --git a/tox.ini b/tox.ini
index 3d0be61..2d62656 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,5 +6,5 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
- nosetests \
+ pytest \
[]
$ tox -e py3
<snip>
py3: commands succeeded
congratulations :)