aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_dist_info.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-07-22 15:21:02 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-07-22 15:21:02 -0400
commit4f7bf7c846ae9761bd10a44f60c656b9741d69be (patch)
tree7bc97f6afabb64fad028478079ff6de58dad17a9 /setuptools/tests/test_dist_info.py
parent9d94aa8feb11530c01dbc9d594f4a5f5c20740ea (diff)
downloadexternal_python_setuptools-4f7bf7c846ae9761bd10a44f60c656b9741d69be.tar.gz
external_python_setuptools-4f7bf7c846ae9761bd10a44f60c656b9741d69be.tar.bz2
external_python_setuptools-4f7bf7c846ae9761bd10a44f60c656b9741d69be.zip
Use DALS to avoid breaking indentation in test setup. Removed flag indicating presence of module.
--HG-- branch : distribute extra : rebase_source : 48d8347f667ec05c28505bc76880dcd64dc43204
Diffstat (limited to 'setuptools/tests/test_dist_info.py')
-rw-r--r--setuptools/tests/test_dist_info.py48
1 files changed, 26 insertions, 22 deletions
diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index fede54da..318cd973 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -4,14 +4,18 @@ import os
import shutil
import tempfile
import unittest
+import textwrap
-import pkg_resources
-from pkg_resources import Requirement
try:
import markerlib
- has_markerlib = True
except:
- has_markerlib = False
+ pass
+
+import pkg_resources
+
+def DALS(s):
+ "dedent and left-strip"
+ return textwrap.dedent(s).lstrip()
class TestDistInfo(unittest.TestCase):
@@ -28,11 +32,11 @@ class TestDistInfo(unittest.TestCase):
assert versioned.version == '2.718' # from filename
assert unversioned.version == '0.3' # from METADATA
- @unittest.skipIf(not has_markerlib,
+ @unittest.skipIf('markerlib' not in globals(),
"install markerlib to test conditional dependencies")
def test_conditional_dependencies(self):
- requires = [Requirement.parse('splort==4'),
- Requirement.parse('quux>=1.1')]
+ requires = [pkg_resources.Requirement.parse('splort==4'),
+ pkg_resources.Requirement.parse('quux>=1.1')]
for d in pkg_resources.find_distributions(self.tmpdir):
self.assertEquals(d.requires(), requires[:1])
@@ -44,25 +48,25 @@ class TestDistInfo(unittest.TestCase):
versioned = os.path.join(self.tmpdir,
'VersionedDistribution-2.718.dist-info')
os.mkdir(versioned)
- open(os.path.join(versioned, 'METADATA'), 'w+').write(
-"""Metadata-Version: 1.2
-Name: VersionedDistribution
-Requires-Dist: splort (4)
-Provides-Extra: baz
-Requires-Dist: quux (>=1.1); extra == 'baz'
-""")
+ open(os.path.join(versioned, 'METADATA'), 'w+').write(DALS(
+ """Metadata-Version: 1.2
+ Name: VersionedDistribution
+ Requires-Dist: splort (4)
+ Provides-Extra: baz
+ Requires-Dist: quux (>=1.1); extra == 'baz'
+ """))
unversioned = os.path.join(self.tmpdir,
'UnversionedDistribution.dist-info')
os.mkdir(unversioned)
- open(os.path.join(unversioned, 'METADATA'), 'w+').write(
-"""Metadata-Version: 1.2
-Name: UnversionedDistribution
-Version: 0.3
-Requires-Dist: splort (==4)
-Provides-Extra: baz
-Requires-Dist: quux (>=1.1); extra == 'baz'
-""")
+ open(os.path.join(unversioned, 'METADATA'), 'w+').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'
+ """))
def tearDown(self):
shutil.rmtree(self.tmpdir)