-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode-pytest unable to read testIds from temp file, file not created #24406
Comments
@karthiknadig any thoughts on why the temp file creation is not working? |
It might be permissions issue with this. We might need to add a check that verifies that the temp file was created. The other thing is not really a file, it is a Unix Domain Socket. I would check permissions first. |
For me on macOS 14.6.1 the error looks like this:
The directory exists and there are plenty of other vscode related files in there (called something like |
Hey @eleanorjboyd, this issue might need further attention. @RamiAwar, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@RamiAwar what machine type are you on? Do you know if you have any permissions added by an administration? |
I'm on a work macbook. Even on that machine, I don't have a problem with regular VSCode running tests, only the devcontainer-ized version! |
@eleanorjboyd May be we can check for this on TS side? I think we can do an access check on the location where we create the file, and log if that is failing. Or attempt an alternate location. |
added a check on the ts side for the temp file. @RamiAwar if you are able to try the python extension pre-release it should be fixed but let me know if not! Thanks |
Hmm not sure what I'm doing wrong but I still get the same issue. I installed pre-release (2025.1.2025021401) on my devcontainer, and then opened up test explorer and tried launching some tests.
Then it proceeds to just run all the tests instead of the ones I asked for. Don't think this fixed it sorry :( @eleanorjboyd I included the specific command details being run, maybe you can spot something that's off there? |
what is your log level at? Can you make sure it is on trace (you can do this by running "developer: set log level" in the command palette). I have these two logs which you should be able to find that would give us more info: this you should see regardless: this you should see if an error on accessing is returned: here's the whole chunk of code: https://github.com/soceanainn/vscode-python/blob/233569307ef9f232aa06707afae799f36a640a62/src/client/testing/testController/common/utils.ts#L52-L66 |
Okay I see them now, I was looking at the Test Explorer output not the Python extension output.
The last few are because I cancelled the run as all the tests were being run, not just the ones I selected. |
@eleanorjboyd let me know how I can debug this further - I'd reaaally like to have this functionality working in my devcontainer, and I'm kind of restricted to using a devcontainer for the time being sadly. I tried digging some more today but didn't really find anything sadly.
I tried adding an alternative 'basetemp' argument to pytest but it wasn't picking it up sadly, still using /tmp for the IDs in the vscode_pytest plugin I think:
Wondering if I can specify a different temp directory for this plugin, then maybe permissions issues can be ruled out? |
it is interesting the check for the temp directory is not catching it- it seems then that the extension (in ts) can access it but that the python subprocess running the tests cannot. @karthiknadig any ideas? I could allow a special argument in the pytest args like |
@eleanorjboyd It looks like we use default tmp dir. I think we should be using XDG_RUNTIME_DIR for Mac. See the implementation for generating named pipes, for path generation on non-windows. We can try using that, and in addition we can also add access check so we can report errors. |
Note that I'm running this on a linux container on my mac, not directly on my mac. I don't think the problem is mac specific. On my mac this works fine, it's just inside the devcontainer vscode instance that this fails! |
I'm getting an error running Pytest on an individual test (using the Test Explorer).
It ends up running the entire test suite instead. Here are some more details. Was told to open this after finding a similar issue, but seems unconnected (#24307 (comment)).
Error[vscode-pytest]: unable to read testIds from temp file[Errno 2] No such file or directory: '/tmp/test-ids-e2faf2fe418633dcef80.txt'
I'm trying to run one test but it 'fails to detect the test ID'.
Note that I'm using devcontainers, with Python + Pylance + pytest explorer installed inside.
Also, not sure if relevant: I looked at /tmp/ but can't see any files named like this. I only see files named like python-test-discovery-698debb64df061b8b350.sock
LOGS:
At this point I see this in my test results:
Error[vscode-pytest]: unable to read testIds from temp file[Errno 2] No such file or directory: '/tmp/test-ids-750dd803c28e00398642.txt'
Python logs don't show anything useful after that and I cancel the test runs. I also watch ls /tmp as I clicked on a test run and only saw the -result files appear. No IDs files.
The text was updated successfully, but these errors were encountered: