nox icon indicating copy to clipboard operation
nox copied to clipboard

refactor: drop path.py

Open henryiii opened this issue 2 years ago • 6 comments

Closes #583. Removes a deprecated dependency.

henryiii avatar Apr 06 '22 02:04 henryiii

I'm not likely to have time to power up a Windows machine to investigate why this is failing on Windows for a couple of days - in a workshop this week. If PATHEXT is off, then don't see why anything works, and if it's right, I don't see why this isn't finding things correctly. Maybe I've got a bug around py handling. 🤷

Also need to think about how to add a test for the "not found locally but found in the default path" branch for coverage, which is showing up on ubuntu except for 3.10. Which is odd.

henryiii avatar Apr 06 '22 18:04 henryiii

Let me check the Windows thing around the next days :wink:

DiddiLeija avatar Apr 06 '22 20:04 DiddiLeija

Thanks for tackling this @henryiii! I can answer the 3.10 coverage thing, it is flagging the same section of code as uncovered (see below)

image

But in the Noxfile we set the coverage fail threshold to 99% here: https://github.com/wntrblm/nox/blob/d947833b58b15a869d6a0f23761fb1e9ffb076db/noxfile.py#L71-L76

This is a hangup from when we started testing on 3.10.0-rc.2 and something about 3.10 made coverage incorrectly flag stuff as uncovered, looking at the coverage logs recently though I think we can remove this little flag (I'll do this later today).

Sadly that doesn't help us with the build failures on this PR, which I agree are a bit weird!

Also need to think about how to add a test for the "not found locally but found in the default path" branch for coverage, which is showing up on ubuntu except for 3.10. Which is odd.

Regarding this, I can't think of a scenario where this would the case? As in where would you have a program that you can't find locally but exists on $PATH? I'll have a think on how we could test for this. Great work so far though!

FollowTheProcess avatar Apr 07 '22 14:04 FollowTheProcess

I think such a scenario would be looking for something like git. It would not be available in the local paths that are being passed, but would be available in the system paths, so it would only be detected in the second run (AFAICT, if you give custom paths, the system paths are then not included).

henryiii avatar Apr 07 '22 18:04 henryiii

That's embarrassing. Just don't look in history and pretend I wrote it correctly the first time. :)

In my defense, I somehow thought the new-in-3.7 text=True parameter also implied capture_output, even though I also knew it was just an alias for universal_newlines=True. That would have been handy, I think...

Also I needed to boot up a Windows box for other things, though I do feel slightly ridiculous needed it to discover this.

I'd really have liked it if this was protected by type - if mypy could tell you couldn't access .stdout/stderr without capturing output in some way, for example!

henryiii avatar Apr 18 '22 20:04 henryiii

Hmm, so it looks like shutil.which expects executables to follow Window's PATHEXT and looks for .exe, .bat, and such. The tests make a no-extension executable, which shutil doesn't find but the py.path tooling did. I'll have to investigate a bit further to see what the best solution is - it's probably at most just needed in the commands.which function if a workaround is needed.

henryiii avatar Apr 19 '22 02:04 henryiii

Closing in favor of #647.

henryiii avatar Oct 07 '22 17:10 henryiii