|
11 | 11 | import collections |
12 | 12 | import json |
13 | 13 | import os |
| 14 | +from netrc import netrc |
14 | 15 | from unittest import mock |
15 | 16 |
|
16 | 17 | from commoncode.testcase import FileDrivenTesting |
17 | 18 | from test_cli import check_json_results |
18 | | -from tinynetrc import Netrc |
19 | 19 |
|
20 | 20 | from _packagedcode.pypi import SetupCfgHandler |
21 | 21 | from python_inspector.resolution import fetch_and_extract_sdist |
|
31 | 31 |
|
32 | 32 | def test_get_netrc_auth(): |
33 | 33 | netrc_file = test_env.get_test_loc("test.netrc") |
34 | | - netrc = Netrc(netrc_file) |
35 | | - assert get_netrc_auth(url="https://pyp1.org/simple", netrc=netrc) == ("test", "test123") |
| 34 | + parsed_netrc = netrc(netrc_file) |
| 35 | + assert get_netrc_auth(url="https://pyp1.org/simple", netrc=parsed_netrc) == ("test", "test123") |
| 36 | + |
| 37 | + |
| 38 | +def test_get_commented_netrc_auth(): |
| 39 | + netrc_file = test_env.get_test_loc("test-commented.netrc") |
| 40 | + parsed_netrc = netrc(netrc_file) |
| 41 | + assert get_netrc_auth(url="https://pyp2.org/simple", netrc=parsed_netrc) == ("test", "test123") |
36 | 42 |
|
37 | 43 |
|
38 | 44 | def test_get_netrc_auth_with_no_matching_url(): |
39 | 45 | netrc_file = test_env.get_test_loc("test.netrc") |
40 | | - netrc = Netrc(netrc_file) |
41 | | - assert get_netrc_auth(url="https://pypi2.org/simple", netrc=netrc) == (None, None) |
| 46 | + parsed_netrc = netrc(netrc_file) |
| 47 | + assert get_netrc_auth(url="https://pypi2.org/simple", netrc=parsed_netrc) == (None, None) |
42 | 48 |
|
43 | 49 |
|
44 | 50 | @mock.patch("python_inspector.utils_pypi.CACHE.get") |
|
0 commit comments