-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locate the Python interpreter via the py.exe launcher #53
Locate the Python interpreter via the py.exe launcher #53
Conversation
Some outstanding questions:
|
Thank you so much for doing this, @pfmoore!
I can handle this - it's likely we'll need to mock some stuff for coverage purposes but have a real test for when on an actual windows platform.
I think so, yes.
Let's just drop the old method. |
nox/virtualenv.py
Outdated
""" | ||
ver = "-%s.%s" % (v_maj, v_min) | ||
script = "import sys; print(sys.executable)" | ||
py_exe = distutils.spawn.find_executable('py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about distutils.spawn.find_executable
! Should we use that over py.path.local.sysfind
which we use in command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I doubt it matters (I lifted that code from tox unchanged). I'd be inclined to go for consistency and follow current practice by using py.path.local.sysfind
in both places. I'll change this.
(BTW, there's also shutil.which
in Python 3.3+. Who said "one obvious way"? 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(BTW, there's also shutil.which in Python 3.3+. Who said "one obvious way"? 😄)
I'd love to make nox 3+ only. Sigh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also make the change to drop the old approach, as noted in your other comment. I can do the tests too, if you want, but if you have a preferred style/approach for the tests and would rather cover that yourself, that's fine too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use pytest so as long as it's not terribly different from what's there go for it. :)
Looking into the coverage failures... |
There's a remaining coverage failure - line 153 in if self.interpreter:
cmd.extend(['-p', self._resolved_interpreter]) I'm not sure why the changes I've made would have caused this line to no longer be executed. @jonparrott do you have any suggestions? |
It's my fault, you can disregard that coverage issue. |
I like that sort of answer ;-) In which case I think this is good to go. Could you check it over for me? |
LGTM- I updated the docstring to mention pep 397. I'm gonna wait for CI to merge (I know it'll fail due to coverage, just want to make sure that's the only failure). |
Thank you so much for doing this @pfmoore! 🍰 |
All good. Merging. :) |
Glad to help 😄 |
🎉 Yay Windows! |
""" | ||
script = "import sys; print(sys.executable)" | ||
py_exe = py.path.local.sysfind('py') | ||
if py_exe: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonparrott Should this be a None
-check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly. If you want you can send a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done #59
Follow-up to wntrblm#53. Also - Using single quotes instead of double quotes - Adding Args/Returns section to docstring
* Adding None-check to `locate_via_py`. Follow-up to #53. Also - Using single quotes instead of double quotes - Adding Args/Returns section to docstring * Updating unit test mocks: faithfully mock `sysfind`.
BTW I am living life happily in Windows land and I can confirm this PR works great (and |
Yay!
…On Sun, Oct 8, 2017, 7:40 PM Danny Hermes ***@***.***> wrote:
BTW I am living life happily in Windows land and I can confirm this PR
works great (and nox was broken-ish before I pip install git+
https://github.com/jonparrott/nox/)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#53 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPUczPAHH3tbtdrcrl1rYgp1OyzcboMks5sqYeBgaJpZM4PcEEV>
.
|
On Windows, if the default strategy for finding a versioned interpreter fails, ask the
py.exe
launcher to locate it for us.