swagger-api / swagger-api/swagger-codegen

[python] drop nose usage for unittest

Open
#11,894 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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 :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

In the generated Python output, inspect test-requirements.txt and tox.ini, starting with their test dependency and command entries shown in the issue. Run tox -e py3 against the generated petstore client and confirm the test command succeeds without the reported nose error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.