Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(23)

#28334: netrc does not work if $HOME is not set

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 years, 3 months ago by d.merej
Modified:
3 years, 3 months ago
Reviewers:
ghost.adh, victor.stinner
CC:
terry.reedy, haypo, berkerpeksag, xiang.zhang, Dimitri Merejkowsky
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/netrc.py View 1 1 chunk +1 line, -4 lines 0 comments Download
Lib/test/test_netrc.py View 1 1 chunk +5 lines, -0 lines 4 comments Download

Messages

Total messages: 5
SilentGhost
https://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py File Lib/test/test_netrc.py (right): https://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py#newcode129 Lib/test/test_netrc.py:129: nrc = netrc.netrc() The test needs to be set ...
3 years, 3 months ago #1
Dimitri Merejkowsky
http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py File Lib/test/test_netrc.py (right): http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py#newcode129 Lib/test/test_netrc.py:129: nrc = netrc.netrc() On 2016/10/02 17:02:45, SilentGhost wrote: > ...
3 years, 3 months ago #2
SilentGhost
On 2016/10/11 10:00:35, Dimitri Merejkowsky wrote: > http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py > File Lib/test/test_netrc.py (right): > > http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py#newcode129 ...
3 years, 3 months ago #3
victor.stinner_gmail.com
http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py File Lib/test/test_netrc.py (right): http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py#newcode129 Lib/test/test_netrc.py:129: nrc = netrc.netrc() You can try something like this: ...
3 years, 3 months ago #4
Dimitri Merejkowsky
3 years, 3 months ago #5
http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py
File Lib/test/test_netrc.py (right):

http://bugs.python.org/review/28334/diff/18741/Lib/test/test_netrc.py#newcode129
Lib/test/test_netrc.py:129: nrc = netrc.netrc()
On 2016/10/18 23:26:48, haypo wrote:
> You can try something like this:
> 
> mock_netrc_file = mock_open(...)
> with patch('netrc.open', mock_netrc_file):
>    nrc = netrc.netrc()

I tried that but it's _really_ nasty. `mock_open()` does not work out of the
box, because netrc uses shlex() which in turns calls fp.read(1) in a while loop,
and then you also have to have correct permissions and mock os.fstat() too
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+