Commit d92bc63d authored by Jason R. Coombs's avatar Jason R. Coombs

Delint

parent ad2d7e48
...@@ -36,6 +36,7 @@ def _get_unpatched(cls): ...@@ -36,6 +36,7 @@ def _get_unpatched(cls):
warnings.warn("Do not call this function", DeprecationWarning) warnings.warn("Do not call this function", DeprecationWarning)
return get_unpatched(cls) return get_unpatched(cls)
def get_metadata_version(dist_md): def get_metadata_version(dist_md):
if dist_md.long_description_content_type or dist_md.provides_extras: if dist_md.long_description_content_type or dist_md.provides_extras:
return StrictVersion('2.1') return StrictVersion('2.1')
...@@ -76,7 +77,7 @@ def write_pkg_file(self, file): ...@@ -76,7 +77,7 @@ def write_pkg_file(self, file):
for field, attr in optional_fields: for field, attr in optional_fields:
attr_val = getattr(self, attr) attr_val = getattr(self, attr)
if six.PY2: if six.PY2:
attr_val = self._encode_field(attr_val) attr_val = self._encode_field(attr_val)
if attr_val is not None: if attr_val is not None:
file.write('%s: %s\n' % (field, attr_val)) file.write('%s: %s\n' % (field, attr_val))
...@@ -562,7 +563,7 @@ class Distribution(Distribution_parse_config_files, _Distribution): ...@@ -562,7 +563,7 @@ class Distribution(Distribution_parse_config_files, _Distribution):
# don't use any other settings # don't use any other settings
'find_links', 'site_dirs', 'index_url', 'find_links', 'site_dirs', 'index_url',
'optimize', 'site_dirs', 'allow_hosts', 'optimize', 'site_dirs', 'allow_hosts',
)) ))
if self.dependency_links: if self.dependency_links:
links = self.dependency_links[:] links = self.dependency_links[:]
if 'find_links' in opts: if 'find_links' in opts:
......
...@@ -11,12 +11,14 @@ from .test_easy_install import make_nspkg_sdist ...@@ -11,12 +11,14 @@ from .test_easy_install import make_nspkg_sdist
import pytest import pytest
def test_dist_fetch_build_egg(tmpdir): def test_dist_fetch_build_egg(tmpdir):
""" """
Check multiple calls to `Distribution.fetch_build_egg` work as expected. Check multiple calls to `Distribution.fetch_build_egg` work as expected.
""" """
index = tmpdir.mkdir('index') index = tmpdir.mkdir('index')
index_url = urljoin('file://', pathname2url(str(index))) index_url = urljoin('file://', pathname2url(str(index)))
def sdist_with_index(distname, version): def sdist_with_index(distname, version):
dist_dir = index.mkdir(distname) dist_dir = index.mkdir(distname)
dist_sdist = '%s-%s.tar.gz' % (distname, version) dist_sdist = '%s-%s.tar.gz' % (distname, version)
...@@ -65,35 +67,45 @@ def __maintainer_test_cases(): ...@@ -65,35 +67,45 @@ def __maintainer_test_cases():
test_cases = [ test_cases = [
('No author, no maintainer', attrs.copy()), ('No author, no maintainer', attrs.copy()),
('Author (no e-mail), no maintainer', merge_dicts(attrs, ('Author (no e-mail), no maintainer', merge_dicts(
attrs,
{'author': 'Author Name'})), {'author': 'Author Name'})),
('Author (e-mail), no maintainer', merge_dicts(attrs, ('Author (e-mail), no maintainer', merge_dicts(
attrs,
{'author': 'Author Name', {'author': 'Author Name',
'author_email': 'author@name.com'})), 'author_email': 'author@name.com'})),
('No author, maintainer (no e-mail)', merge_dicts(attrs, ('No author, maintainer (no e-mail)', merge_dicts(
attrs,
{'maintainer': 'Maintainer Name'})), {'maintainer': 'Maintainer Name'})),
('No author, maintainer (e-mail)', merge_dicts(attrs, ('No author, maintainer (e-mail)', merge_dicts(
attrs,
{'maintainer': 'Maintainer Name', {'maintainer': 'Maintainer Name',
'maintainer_email': 'maintainer@name.com'})), 'maintainer_email': 'maintainer@name.com'})),
('Author (no e-mail), Maintainer (no-email)', merge_dicts(attrs, ('Author (no e-mail), Maintainer (no-email)', merge_dicts(
attrs,
{'author': 'Author Name', {'author': 'Author Name',
'maintainer': 'Maintainer Name'})), 'maintainer': 'Maintainer Name'})),
('Author (e-mail), Maintainer (e-mail)', merge_dicts(attrs, ('Author (e-mail), Maintainer (e-mail)', merge_dicts(
attrs,
{'author': 'Author Name', {'author': 'Author Name',
'author_email': 'author@name.com', 'author_email': 'author@name.com',
'maintainer': 'Maintainer Name', 'maintainer': 'Maintainer Name',
'maintainer_email': 'maintainer@name.com'})), 'maintainer_email': 'maintainer@name.com'})),
('No author (e-mail), no maintainer (e-mail)', merge_dicts(attrs, ('No author (e-mail), no maintainer (e-mail)', merge_dicts(
attrs,
{'author_email': 'author@name.com', {'author_email': 'author@name.com',
'maintainer_email': 'maintainer@name.com'})), 'maintainer_email': 'maintainer@name.com'})),
('Author unicode', merge_dicts(attrs, ('Author unicode', merge_dicts(
attrs,
{'author': '鉄沢寛'})), {'author': '鉄沢寛'})),
('Maintainer unicode', merge_dicts(attrs, ('Maintainer unicode', merge_dicts(
attrs,
{'maintainer': 'Jan Łukasiewicz'})), {'maintainer': 'Jan Łukasiewicz'})),
] ]
return test_cases return test_cases
@pytest.mark.parametrize('name,attrs', __maintainer_test_cases()) @pytest.mark.parametrize('name,attrs', __maintainer_test_cases())
def test_maintainer_author(name, attrs, tmpdir): def test_maintainer_author(name, attrs, tmpdir):
tested_keys = { tested_keys = {
...@@ -127,4 +139,3 @@ def test_maintainer_author(name, attrs, tmpdir): ...@@ -127,4 +139,3 @@ def test_maintainer_author(name, attrs, tmpdir):
else: else:
line = '%s: %s' % (fkey, val) line = '%s: %s' % (fkey, val)
assert line in pkg_lines_set assert line in pkg_lines_set
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