ChristianRRL
Honored Contributor II

Hi there, I wanted to briefly follow-up on this. From what I'm seeing, the error is due to pytest trying to write __pycache__ under /Workspace/..., and that filesystem doesn’t support that write mode.

In order to resolve this, I tried adding two command line arguments:

  • PYTHONDONTWRITEBYTECODE=1
  • --assert=plain
(I also added -p no:cacheprovider, but this is only to avoid writing out the .pytest_cache folder in my Workspace)
 
After adding these CLI args in pytest, I am finally seeing successful tests!
 
The same fix works in the equivalent pytest python logic, including: 
  • sys.dont_write_bytecode = True
  • result = pytest.main(["--assert=plain", "-p", "no:cacheprovider", "-q"])
 
 
See attached examples.
 

View solution in original post