First time here? Check out the FAQ!
1

pytest runner issue

I use WingWare with a project structure generation tool called pyscaffold (its very cool, and helps to ensure all your imports always work). Recently I have started to get errors on Linux and Windows when running pytest tests on pyscaffold projects from within Wingware Pro. On the command line pytest and python setup.py test all work fine. But when I run pytest from within Wing in the same environment I get this error: ERROR: usage: run_pytest_xml.py[options][file_or_dir][file_or_dir][...] run_pytest_xml.py: error: unrecognized arguments: --verbose inifile: c: \Users\chq - andym\projects\mattermost\setup.cfg rootdir: c: \Users\chq - andym\projects\mattermost

I have a setup.cfg that the pyscaffold-created setup.py reads, and the pytest sections look like this:

[tool:pytest] # Options for py.test: # Specify command line options as you would do when invoking py.test directly. # e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml # in order to write a coverage file that can be read by Jenkins. addopts = --cov mattermost --cov-report term-missing --verbose norecursedirs = dist build .tox testpaths = tests

If I comment out the --verbose pytest runs I tried changing --verbose to -v and it still fails. Also, I tried --version and -v on the -cov etc line and it still fails

It would be great if this can be fixed. Thanks! And btw, it would be fantastic if Wing could integrate with Pyscaffold in the New Project dialog

andykmiles's avatar
76
andykmiles
asked 2020-02-19 11:34:12 -0500
Wingware Support's avatar
4.1k
Wingware Support
updated 2020-02-20 15:34:09 -0500
edit flag offensive 0 remove flag close merge delete

Comments

What version of pytest are you using?

Wingware Support's avatar Wingware Support (2020-02-19 16:33:32 -0500) edit

Python 3.7.4, pytest-5.3.5

andykmiles's avatar andykmiles (2020-02-19 17:07:59 -0500) edit
add a comment see more comments

1 Answer

0

It works if you remove the --verbose flag. The flag causes problems because Wing adds -p no:terminal arguments to disable displaying results to a terminal and --verbose is not recognized as an argument when -p no:terminal is used (this is a pytest bug). When Wing runs pytest, the output that you normally see is not generated, instead Wing tracks which tests succeed & fail and captures output sent to stdout and stderr by each test.

Also the cov plugin doesn't work with Wing's debugger because both try to use the trace function. This means that you can't debug tests from Wing's Testing tool, which is arguably one of the best reasons to run tests from Wing.

Wingware Support's avatar
4.1k
Wingware Support
answered 2020-02-20 14:05:39 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer