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
Expected behavior
To run the test suite.
Steps to reproduce:
- Use the following setting:
{
"python.unitTest.pyTestArgs": ["-p", "no:sugar"]
}
- Click on "Debug test".
Logs
Output for the Python Test Log.
usage: pytest.py [options] [file_or_dir] [file_or_dir] [...]
pytest.py: error: argument -p: expected one argument
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:sugaroption 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.pyTestArgsis filtered to remove any argument that doesn't starts with a-, which fails when running options like-por-c.The only ways I figure out to work around this is:
file_or_dirargument from the rest. E.g.pyTestFilesOrDirsfrompyTestArgs. 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:
{ "python.unitTest.pyTestArgs": ["-p", "no:sugar"] }Logs
Output for the
Python Test Log.