From 2f0e172bdab76b0c972b5d1480bcccc88f63c7ec Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 14 Dec 2015 04:48:26 -0500 Subject: Add test capturing InterpolationSyntaxError on Python 3 and KeyError on Python 2 --- setuptools/tests/test_packageindex.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'setuptools/tests/test_packageindex.py') 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%' -- cgit v1.2.3