2
votes

The goal is simple: run tests with pytest in Visual Studio Code

The python extension is configured for tests successfully, the test are discovered successfully, no conftest.py file is in the project but when I start to run the tests I get the following:

usage: pytest-script.py [options] [file_or_dir] [file_or_dir] [...]
pytest-script.py: error: unrecognized arguments: --rootdir ./test_reporter.py
  inifile: None
  rootdir: c:\Users\...\project-dir
Error: TypeError: Cannot read property 'testsuites' of null

Why does the VS code send the "unrecognized" argument? What does the last line mean? How to fit it all?

I used python 3.7 from Anaconda on D: and set absolute path to the pytest in Anaconda's Script directory

  • VS Code: 1.45.1
  • pytest: 4.3.1
1

1 Answers

2
votes

The second error is consequence of the first error.

The first error was solved by upgrading pytest to 5.4.2