Kaydet (Commit) c529af3f authored tarafından Berker Peksag's avatar Berker Peksag

Issue #20120: Add a test case to verify the % char can be used in .pypirc

I noticed that there is no test for this feature while doing
triaging work on pypa/pypi-legacy.
üst 947f099d
...@@ -18,6 +18,7 @@ PYPIRC = """\ ...@@ -18,6 +18,7 @@ PYPIRC = """\
index-servers = index-servers =
server1 server1
server2 server2
server3
[server1] [server1]
username:me username:me
...@@ -28,6 +29,10 @@ username:meagain ...@@ -28,6 +29,10 @@ username:meagain
password: secret password: secret
realm:acme realm:acme
repository:http://another.pypi/ repository:http://another.pypi/
[server3]
username:cbiggles
password:yh^%#rest-of-my-password
""" """
PYPIRC_OLD = """\ PYPIRC_OLD = """\
...@@ -113,6 +118,20 @@ class PyPIRCCommandTestCase(support.TempdirManager, ...@@ -113,6 +118,20 @@ class PyPIRCCommandTestCase(support.TempdirManager,
finally: finally:
f.close() f.close()
def test_config_interpolation(self):
# using the % character in .pypirc should not raise an error (#20120)
self.write_file(self.rc, PYPIRC)
cmd = self._cmd(self.dist)
cmd.repository = 'server3'
config = cmd._read_pypirc()
config = list(sorted(config.items()))
waited = [('password', 'yh^%#rest-of-my-password'), ('realm', 'pypi'),
('repository', 'https://pypi.python.org/pypi'),
('server', 'server3'), ('username', 'cbiggles')]
self.assertEqual(config, waited)
def test_suite(): def test_suite():
return unittest.makeSuite(PyPIRCCommandTestCase) return unittest.makeSuite(PyPIRCCommandTestCase)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment