You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the pytest-sugar to prettify my tests but need to disable it to have a more standard output to have full file paths instead of coloured shortened ones. This need the -p no:sugar option to be given.
Also many other options need arguments because aren't simple flags, like -c config.file.
When running a specifc test (e.g. clicking in "Run test" or "Debug test" above test definition), the settings.unitTest.pyTestArgs is filtered to remove any argument that doesn't starts with a -, which fails when running options like -p or -c.
The only ways I figure out to work around this is:
Remove this filter. Not wanted, because would force users to have a setup.cfg or something like it;
Hardcode all pytest options;
Separate the positional file_or_dir argument from the rest. E.g. pyTestFilesOrDirs from pyTestArgs. This is my personal choice.
I would submit a pull requests, but the contributing guide says to open a issue first.
Environment data
VS Code version: 1.20.1
Extension version 2018.2.1 and master
OS and version: Fedora 27
Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.3
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
Relevant/affected Python packages and their versions: pytest
Actual behavior
Simply put, many pytest options aren't supported when running specific tests
Yet another possibility is to parse the output of pytest --help to identify options that receive an argument, is pretty standard. For instance the ' (--[a-z0-9-]+)=[^ ]+' regex for long options and ' (-[a-z0-9-]+) [^ ]+' for short ones.
It is also somewhat safe like the third possibility I said before.
I use the pytest-sugar to prettify my tests but need to disable it to have a more standard output to have full file paths instead of coloured shortened ones. This need the
-p no:sugar
option to be given.Also many other options need arguments because aren't simple flags, like
-c config.file
.When running a specifc test (e.g. clicking in "Run test" or "Debug test" above test definition), the
settings.unitTest.pyTestArgs
is filtered to remove any argument that doesn't starts with a-
, which fails when running options like-p
or-c
.The only ways I figure out to work around this is:
file_or_dir
argument from the rest. E.g.pyTestFilesOrDirs
frompyTestArgs
. This is my personal choice.I would submit a pull requests, but the contributing guide says to open a issue first.
Environment data
Actual behavior
Simply put, many pytest options aren't supported when running specific tests
Expected behavior
To run the test suite.
Steps to reproduce:
Logs
Output for the
Python Test Log
.The text was updated successfully, but these errors were encountered: