summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-06-20 18:41:34 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-06-20 18:41:34 (GMT)
commitc529af3fcb2c1a48780f66291970f4527659fa30 (patch)
treea604ba644e6d8c06b17d12f2f4ef75e3a8598008 /Lib/distutils/tests
parent947f099d99f52badb14837066463c44b63476cfd (diff)
downloadcpython-c529af3fcb2c1a48780f66291970f4527659fa30.zip
cpython-c529af3fcb2c1a48780f66291970f4527659fa30.tar.gz
cpython-c529af3fcb2c1a48780f66291970f4527659fa30.tar.bz2
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.
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_config.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py
index 4de825a..0b91d19 100644
--- a/Lib/distutils/tests/test_config.py
+++ b/Lib/distutils/tests/test_config.py
@@ -18,6 +18,7 @@ PYPIRC = """\
index-servers =
server1
server2
+ server3
[server1]
username:me
@@ -28,6 +29,10 @@ username:meagain
password: secret
realm:acme
repository:http://another.pypi/
+
+[server3]
+username:cbiggles
+password:yh^%#rest-of-my-password
"""
PYPIRC_OLD = """\
@@ -113,6 +118,20 @@ class PyPIRCCommandTestCase(support.TempdirManager,
finally:
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():
return unittest.makeSuite(PyPIRCCommandTestCase)