To be able to run a useful test, it would have to be run on a Windows machine with py.exe installed, where at least one of the Python versions was not installed in the standard location. I can probably write such code, but it will likely only prove anything when run on my PC :-) Is that OK?
Or I could alter the patch somehow to make it testable (maybe by adding an argument to find_executable, defaulting to False, which disabled the check for the standard locations so that my code could get tested). Would that be a more acceptable option?
doesn't need to be a fully functional test. You could put the py.exe functionality into a function and test that function, possibly by accepting monkeypatch in the test function and then do something like monkeypath(py.path.local, "sysfind", PseudoPath) and have PseudoPath have a static sysexe() method. This way the full code path can run, and we just assume that py.exe behaves correctly.