pytest-mypy-plugins icon indicating copy to clipboard operation
pytest-mypy-plugins copied to clipboard

Testing changes and caching behaviour

Open delfick opened this issue 1 year ago • 5 comments

Hello,

I'm not sure if I'm missing something obvious, but is there patterns for testing how my plugin interacts with mypy caching for both mypy and dmypy when code is changed?

So say I make a test case with code in a particular way and it passes mypy. I want a test that show it still passes mypy if I change that code in a particular way. Same with dmypy.

delfick avatar Mar 29 '24 03:03 delfick

Right now this is not supported, but PR for this would be really welcomed! Mypy test cases have a similar design, here: https://github.com/python/mypy/blob/master/test-data/unit/check-incremental.test

sobolevn avatar Mar 29 '24 08:03 sobolevn

mmkay, I thought so. Thanks. I will add this to the list of things I want to look at (no guarantees on a timeline :p)

delfick avatar Mar 29 '24 08:03 delfick

So on this, once you're happy with https://github.com/typeddjango/pytest-mypy-plugins/pull/152 and that's merged, I have one last prefactor lined up (https://github.com/delfick/pytest-mypy-plugins/compare/schema/split-from-execution...delfick:pytest-mypy-plugins:separation/use-fixtures, will have an explanation of what it's doing when I make it a PR) and then finally the changes to make it possible to specify followups - https://github.com/delfick/pytest-mypy-plugins/compare/separation/use-fixtures...delfick:pytest-mypy-plugins:scenarios/followups

Though I have a problem I haven't quite being able to figure out where I change a file and then mypy doesn't see the change to that file. But if I do the same thing outside of pytest it does see the change. It's very weird.

edit: using the power of sleeping on it, I fixed the problem https://github.com/delfick/pytest-mypy-plugins/commit/89f2d5277c22872205616469065037e79b1a04e9

delfick avatar May 06 '24 08:05 delfick

yay, after that current PR and the next two, I think I have all the changes in a state that is ready to use, was able to make this test on my extension on django-stubs https://github.com/delfick/extended-mypy-django-plugin/actions/runs/8981236513/job/24666367526 to show one of the things I need to fix that was slowing me down so much (an edge case where an app is removed from INSTALLED_APPS but is still present on the file system)

delfick avatar May 07 '24 07:05 delfick

@sobolevn hello, I was wondering, I do want to eventually upstream these changes to this project, but my changes are quite extensive and your time for reviewing appears to be limited. Do you mind if I make my fork into it's own package in the meantime?

delfick avatar May 23 '24 03:05 delfick