diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-14 04:48:26 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-14 04:48:26 -0500 |
commit | 2f0e172bdab76b0c972b5d1480bcccc88f63c7ec (patch) | |
tree | 88b30a827bd8bec4f5761e94a90da7812f38e6a8 /setuptools/tests | |
parent | 5eafe7644d18eddd77a5573ecc30b4c98efbb2c6 (diff) | |
download | external_python_setuptools-2f0e172bdab76b0c972b5d1480bcccc88f63c7ec.tar.gz external_python_setuptools-2f0e172bdab76b0c972b5d1480bcccc88f63c7ec.tar.bz2 external_python_setuptools-2f0e172bdab76b0c972b5d1480bcccc88f63c7ec.zip |
Add test capturing InterpolationSyntaxError on Python 3 and KeyError on Python 2
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_packageindex.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index dcd90d6f..897590e8 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -1,7 +1,11 @@ +from __future__ import absolute_import + import sys +import os import distutils.errors from setuptools.compat import httplib, HTTPError, unicode, pathname2url +from .textwrap import DALS import pkg_resources import setuptools.package_index @@ -201,3 +205,20 @@ class TestContentCheckers: 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478') rep = checker.report(lambda x: x, 'My message about %s') assert rep == 'My message about md5' + + +class TestPyPIConfig: + def test_percent_in_password(self, tmpdir, monkeypatch): + monkeypatch.setitem(os.environ, 'HOME', str(tmpdir)) + pypirc = tmpdir / '.pypirc' + with pypirc.open('w') as strm: + strm.write(DALS(""" + [pypi] + repository=https://pypi.python.org + username=jaraco + password=pity% + """)) + cfg = setuptools.package_index.PyPIConfig() + cred = cfg.creds_by_repository['pypi'] + assert cred.username == 'jaraco' + assert cred.password == 'pity%' |