Test coverage does not update when using remote interpreter
For some odd reason when I am using the remote interpreter to "run test with coverage", it does not update the coverage in PyCharm.
The test runs fine locally and on the remote server with 100% success. When I run locally I can see all the percentages and all the lines that were hit by my test cases but that's not the case when I use remote interpreter.
The only strange thing I found which may be related is that when I debug my tests I get the following error from the debugger:
Couldn't apply path mapping to the remote file. /app/user/home/myuser/myproject/app/tests/test_rules.py can't be found in project. You can continue debugging, but without the source. To fix that you can do one of the following:
Edit settings of path mapping in remote debug configuration
Auto-detect path mapping settings
Download source from remote host
This does not happen when I debug my code. I have checked all the settings under the Deployment settings page and the mapping configuration seems to be correct and working fine with the rest of the project for normal debugging.
Any idea why this is happening and how I can get it fixed?
Please sign in to leave a comment.
Hello,
Any insights to this problem?
I experience it when I try to step in to a installed python package.
Hi, the issue did not reproduce for me - the coverage appears to be working fine with the SSH interpreter.
Are you using bundled coverage option from **Preferences | Build, Execution, Deployment | Coverage** ?
Does the issue reproduce if you test it in a new minimal project?
Well, I was able to figure out the issue. This was a long time ago, so I try my best to remember what happened. One of the project path values was through a shortcut and that was causing the issue. Sorry, do not remember the details.
This is bothering me quite a bit as I used to be able to run with coverage in an older PyCharm version (on a remote interpreter) and it would seamless display in the IDE. After upgrading to 2022.2.1 this does not happen.
The coverage report in XML form is still generated, on the remote host. I can download it locally and ask PyCharm to display it. However, it does not given sensible coverage info (i.e. showing many files as "not covered" when I know for a fact they are covered).
Perhaps part of the problem is the mappings in the XML are not converted from the remote path to the local. I can see when I open that XML it has the paths of each file as the remote knows them, but not the local paths. However I have not had success in getting PyCharm to correctly display the coverage after manually converting those paths in the XML to be consistent with the local project structure.
Running with test coverage on a remote interpreter and no coverage data is found by PyCharm. Both with bundled coverage and without. Running the same tests on the local interpreter and everything works.