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

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?

Related

How to solve Taskhash mismatch and metadata is not deterministic in Yocto project build?

I am facing "Taskhash mismatch" & "The metadata is not deterministic and this needs to be fixed" error in Yocto project build. This issue arises without any obvious reasons. With a perfectly good source code repo, the build is success sometime, while it fails some time. There is no change in source code/recipe or any other build parameters.
Error log:
ERROR: When reparsing /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb:do_populate_lic, the basehash value changed from e0bfa2ad64f24d189d23f9d84918c74a7253e0d7e9c7fea4e3346cbc473d43da to c108c533ec82c43aa15730e4ca9c9838f87133e63417f40af0de8ca8cb43f51a. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake sub_project-rootfs-base -cdo_populate_lic -Snone
ERROR: Then:
ERROR: $ bitbake sub_project-rootfs-base -cdo_populate_lic -Sprintdiff
ERROR: sub_project-rootfs-base-1.0+gitAUTOINC+db239d9f5b-r2 do_package_qa: Taskhash mismatch 87d8616452c2be01481a9034e9147f0270a57a3f64f85cde65076863b8123c7c versus 9a7fd3b27e62140001d77ab75dbc2026dac8e6c8ca93a487b1857a76f2b6b2yy for /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb:do_package_qa
ERROR: Taskhash mismatch 87d8616452c2be01481a9034e9147f0270a57a3f64f85cde65076863b8123c7c versus 9a7fd3b27e62140001d77ab75dbc2026dac8e6c8ca93a487b1857a76f2b6b2yy for /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb:do_package_qa
ERROR: sub_project-rootfs-base-1.0+gitAUTOINC+db239d9f5b-r2 do_package_write_rpm: Taskhash mismatch 9a7fd3b27e62140001d77ab75dbc2026dac88qc8ca93a487b1857a76f2b6b2yy versus 9a7fd3b27e6217l0001d77ab75dbc2026dac8e6c8ca93a487b1857a76f2b6b2yy for /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb:do_package_write_rpm
ERROR: Taskhash mismatch 9a7fd3b27e62140001d77ab75dbc2026dac88qc8ca93a487b1857a76f2b6b2yy versus 9a7fd3b27e6217l0001d77ab75dbc2026dac8e6c8ca93a487b1857a76f2b6b2yy for /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb:do_package_write_rpm
I resolved this issue by doing two of the following action.
Clean the recipe which throws error during build using following command
bitbake -c cleansstate sub_project-rootfs-base
Update the bb file timestamp by doing empty write or by touching file.
Open the bb file using your editor - vim /home/user/my_project/yocto/sub_project-yocto/meta-subproject/meta-base/recipes-core/sub_project-rootfs-base/sub_project-rootfs-base.bb
Write the file by clicking save button or in vim writing ":w" command
Close the file using "x" button or ":q" command.
Rebuild the project as usual.
Edit : In case there are multiple bitbake recipes showing this error, you can touch all bb files and build again. Go into your yocto folder and run following command. This will take some to touch all file and significantly higher time to rebuild the project.
find . -type f -name "*.bb" -exec touch {} +

How to solve error on docker:layers_calculator to compute the Merkle tree on private tangle?

I want to setup a private tangle on my own virtual machine with Ubuntu 18.04, 4GB RAM and 20GB memory.
I have follow this instructions: https://docs.iota.org/docs/compass/0.1/how-to-guides/set-up-a-private-tangle. Every command works fine until reach this one: bazel run //docker:layers_calculator.
It shows an error as follows:
Starting local Bazel server and connecting to it...
ERROR: /home/istabraq/compass/third-party/maven_deps.bzl:3:5: Traceback (most recent call last):
File "/home/istabraq/compass/WORKSPACE", line 42
maven_jars()
File "/home/istabraq/compass/third-party/maven_deps.bzl", line 3, in maven_jars
native.maven_jar(<4 more arguments>)
type 'struct' has no method maven_jar()
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
INFO: Elapsed time: 4.743s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
How can I solve this problem? what I have missed?
read carefully the message given after running bazel installer:
Make sure you have "/home/yourusername/bin" in your path. You can also activate bash completion by adding the following line to your :
source /home/yourusername/.bazel/bin/bazel-complete.bash
You can check with: "bazel info" or "bazel version"
Unfortunately, there are further errors:
https://github.com/iotaledger/compass/issues/142
I have solve this issue by using this commands:
Step 3: Set up your environment
If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It’s a good idea to add this directory to your default paths, as follows:
export PATH="$PATH:$HOME/bin"
You can also add this command to your ~/.bashrc or ~/.zshrc file to make it permanent.
reference:
https://docs.bazel.build/versions/master/install-ubuntu.html

Continue after a failing command in appveyor

In appveyor I use the statement:
- initexmf --admin --force --mklinks
but due to a problem it gives the message:
initexmf --admin --force --mklinks
Sorry, but "MiKTeX Configuration Utility" did not succeed for the following reason:
Script configuration file not found.
The log file hopefully contains the information to get MiKTeX going again:
C:\ProgramData\MiKTeX\2.9\miktex\log\initexmf_admin.log
The system cannot find the path specified.
Command exited with code 1
due to the error code the process terminates and I cannot type the C:\ProgramData\MiKTeX\2.9\miktex\log\initexmf_admin.log anymore, so a bit hard to debug ...
questions:
How to continue after an error
How to stop after the outputting the file (exit 1 ?)
To run a script on failure use on_failure section, for example to push initexmf_admin.log to artifacts:
on_failure:
- appveyor PushArtifact C:\ProgramData\MiKTeX\2.9\miktex\log\initexmf_admin.log

Issue with building a haskell-stack postgresql project

I'm trying to use stack to set up the yesod-postgres template project on my Windows machine. Unfortunately, when I run stack build I get the following result:
pg-project-0.0.0: build
Preprocessing library pg-project-0.0.0...
In-place registering pg-project-0.0.0...
Preprocessing executable 'pg-project' for pg-project-0.0.0...
Linking .stack-work\dist\95439361\build\pg-project\pg-project.exe ...
C:/Users/Rik/AppData/Local/Programs/stack/i386-windows/ghc-7.10.3/mingw/bin/ld.exe: cannot find -lpq
collect2.exe: error: ld returned 1 exit status
-- While building package pg-project-0.0.0 using:
C:\stack_root\setup-exe-cache\i386-windows\setup-Simple-Cabal-1.22.5.0-ghc-7.10.3.exe --builddir=.stack-work\dist\95439361 build lib:pg-project exe:pg-project --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
I've added C:\PostgreSQL\bin to my PATH, and I'm using the 32-bit version of PostgreSQL 9.5.
Any help is appreciated.

breaking on unhandled exceptions in pydev/gae

i am using pydev to develop a google app engine application. i followed the steps mentioned here to configure pydev debugger to break on unhandled exception. i could get it to work on a sample pydev project, but when i try the same steps in my pydev gae project, it doesn't work and gives following error:
pydev debugger: warning: psyco not
available for speedups (the debugger
will still work correctly, but a bit
slower) pydev debugger: starting
...
Traceback (most recent call last):
File "c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 3858, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File
"c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 3792, in _Dispatch
base_env_dict=env_dict) File "c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 580, in Dispatch
base_env_dict=base_env_dict) File "c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 2918, in Dispatch
self._module_dict) File "c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 2822, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path,
hook) File "c:\program
files\google\google_appengine\google\appengine\tools\dev_appserver.py",
line 2702, in ExecuteOrImportScript
exec module_code in script_module.dict File
"C:\Users\siddjain\workspace\rfad\src\main.py",
line 1, in
import pydevd ImportError: No module named pydevd
my debug configuration for gae project is like this:
the sample pydev project where it works is like this and am following same pattern in my gae project:
import pydevd
def f(x,y):
z = y/x;
return z;
def main():
pydevd.set_pm_excepthook()
print f(0,0)
if __name__ == '__main__':
main()
the run config for test project is like this:
the pydevd.py module is under C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc. Although this path is not included in the pythonpath for test project, the breaking works in test. i also tried including this path in pythonpath of gae project to see if that fixes my problem, but it didn't
Its still not fixed although following steps got rid of No module named pydevd error:
1. Create a symlink to C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc:
src>mklink /d debugger C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc
2. Put an empty __init__.py file in C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc. i learnt this from some google link that i can't find now.
3. In source code:
import debugger.pydevd as pydevd
after these steps its able to import pydevd, but still doesn't break on uncaught exception.
The development server runs your application on your local computer for testing your application. The server simulates the App Engine datastore, services and sandbox restrictions (hence step 1). although i don't understand why we need to import pydevd since its pydevd who's running our application in the first place!
In the Run->Debug Configurations->Interpreter tab if I click on "see resulting command line..."
C:\Python25\python.exe -u
C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc\pydevd.py
--vm_type python --client 127.0.0.1 --port 0 --file "c:\program
files\google\google_appengine\dev_appserver.py"
The PYTHONPATH that will be used is:
C:\eclipse\plugins\org.python.pydev_2.0.0.2011040403\PySrc\pydev_si...