VS Code and pytest: Where is the default junit-xml output path defined and why is there one?

Viewed 221

I am trying to run a debug the tests of my Python project inside the VS Code interface. I followed the instruction from VS Code's website using pytest but when trying to run a test the output fails:

============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: c:\Users\myUserName\Projects\myProjectName
plugins: localserver-0.5.0
collected 1 item

myProjectName\tests\test_static_analysis.py .                                   [100%]

- generated xml file: C:\Users\MYUSERNAME\AppData\Local\Temp\tmp-26696NTXW7ChqfMEN.xml 
-
============================== 1 passed in 0.18s ==============================
Error: Error: cannot open file:///c%3A/Users/myUserName/Projects/myProjectName/C. Detail: 
Unable to read file 'c:\Users\myUserName\Projects\myProjectName\C' (Error: Unable to resolve 
non-existing file 'c:\Users\myUserName\Projects\myProjectName\C')
Error: Error: cannot open file:///c%3A/Users/myUserName/Projects/myProjectName/C. Detail: 
Unable to read file 'c:\Users\myUserName\Projects\myProjectName\C' (Error: Unable to resolve 
non-existing file 'c:\Users\myUserName\Projects\myProjectName\C')

Maybe VS Code doesn't have the authorization to write in AppData.

What concerns me is why is VS Code launching pytest with a junit-xml output option? The command actually executed by VS Code is:

c:; cd 'c:\Users\myUserName\Projects\myProjectName'; & 'C:\ProgramData\Anaconda3\envs\venv-myProjectName\python.exe' 'c:\Users\myUserName\.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher' '53774' '--' 'c:\Users\myUserName\.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\testlauncher.py' 'c:\Users\myUserName\Projects\myProjectName' 'pytest' '--override-ini' 'junit_family=xunit1' '--rootdir' 'c:\Users\myUserName\Projects\myProjectName' '--junit-xml=C:\Users\MYUSERNAME\AppData\Local\Temp\tmp-26696pYh1w3pF2cXx.xml' './myProjectName/tests/test_static_analysis.py::TestStaticAnalysisVesselForceOnLateralCenter::test_pos_surge_on_vessel' 

When going in Settings > python.testing.pytestArgs it is empty.

  • Where is this output path defined?
  • How can I change it to be in the local working directory?
  • Do I need to have a junit-xml output? Is it mandatory for VS Code UI to work?
0 Answers
Related