aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-01 16:34:23 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-01 16:34:23 -0500
commitef3ee2cfee65f99d320983cbf6e32448b2cefbbe (patch)
treeaa17c8b699e5e5ea2f5e2de9f48485342bcbe91f /setuptools/tests
parenta476eca3548d454b7b9589f4e10c91c17e491c1f (diff)
downloadexternal_python_setuptools-ef3ee2cfee65f99d320983cbf6e32448b2cefbbe.tar.gz
external_python_setuptools-ef3ee2cfee65f99d320983cbf6e32448b2cefbbe.tar.bz2
external_python_setuptools-ef3ee2cfee65f99d320983cbf6e32448b2cefbbe.zip
Extract commonality of metadata template.
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_dist_info.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 812e6c46..91195c52 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -38,33 +38,36 @@ class TestDistInfo:
assert d.requires(extras=('baz',)) == requires
assert d.extras == ['baz']
+ metadata_template = DALS("""
+ Metadata-Version: 1.2
+ Name: {name}
+ {version}
+ Requires-Dist: splort (==4)
+ Provides-Extra: baz
+ Requires-Dist: quux (>=1.1); extra == 'baz'
+ """)
+
def setup_method(self, method):
self.tmpdir = tempfile.mkdtemp()
versioned = os.path.join(self.tmpdir,
'VersionedDistribution-2.718.dist-info')
os.mkdir(versioned)
with open(os.path.join(versioned, 'METADATA'), 'w+') as metadata_file:
- metadata_file.write(DALS(
- """
- Metadata-Version: 1.2
- Name: VersionedDistribution
- Requires-Dist: splort (4)
- Provides-Extra: baz
- Requires-Dist: quux (>=1.1); extra == 'baz'
- """))
+ metadata = self.metadata_template.format(
+ name='VersionedDistribution',
+ version='',
+ ).replace('\n\n', '\n')
+ metadata = metadata.replace('==4', '4')
+ metadata_file.write(metadata)
unversioned = os.path.join(self.tmpdir,
'UnversionedDistribution.dist-info')
os.mkdir(unversioned)
with open(os.path.join(unversioned, 'METADATA'), 'w+') as metadata_file:
- metadata_file.write(DALS(
- """
- Metadata-Version: 1.2
- Name: UnversionedDistribution
- Version: 0.3
- Requires-Dist: splort (==4)
- Provides-Extra: baz
- Requires-Dist: quux (>=1.1); extra == 'baz'
- """))
+ metadata = self.metadata_template.format(
+ name='UnversionedDistribution',
+ version='Version: 0.3',
+ )
+ metadata_file.write(metadata)
def teardown_method(self, method):
shutil.rmtree(self.tmpdir)