tarpas / pytest-testmon

Selects tests affected by changed files. Executes the right tests first. Continuous test runner when used with pytest-watch.
https://testmon.org
MIT License
800 stars 54 forks source link

Support detecting changes in symlinked files #231

Closed marcodicro-dp closed 2 months ago

marcodicro-dp commented 4 months ago

I want to implement Testmon for my project but I currently have symlinked files. Both test and non-test files. So what happens is: Testmon DOES NOT detect modified symlinked tests files, so it does not run them. Even if I added new tests. Testmon DOES NOT detect modified symlinked files. So it does not run the tests that have coverage over it (in this case the test file is not necessary symlinked, but the modified file is)

I'd like for testmon to be work of the box for this

I'm considering building a pre-processing script that resolves the symlinked files to real files. To see if testmon detects changes after that.

The obstacle I have with that approach is that I want to build the testmon database in master test runs, and then use that testmon DB on PR runs. So basically I have to combine the pre-processing script with the PR changes and I think I could have some conflicts when resolving that.

Let me know if this is a coverage.py limitation or if someone already asked about this. I didn't find anything.

Thank you!

marcodicro-dp commented 2 months ago

Seems I had this problem because some of my symlinked tests/files were outside the ROOTDIR where I was running the tests (using tox), so that's why testmon was not detecting those changes.

Everything started to work well after I set rootdir to the repo's root by using --rootdir={toxinidir}/../..

Sharing this in case it works for other folks!