aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-12-30 10:20:30 -0500
committerJason R. Coombs <jaraco@jaraco.com>2014-12-30 10:20:30 -0500
commitde1af740bc79592faac63b3c0c8d50383b373dd4 (patch)
tree0bf9c4307c05becec53adf4a2caa4c3c72a02f31
parentf678f5c1a197c504ae6703f3b4e5658f9e2db1f6 (diff)
downloadexternal_python_setuptools-de1af740bc79592faac63b3c0c8d50383b373dd4.tar.gz
external_python_setuptools-de1af740bc79592faac63b3c0c8d50383b373dd4.tar.bz2
external_python_setuptools-de1af740bc79592faac63b3c0c8d50383b373dd4.zip
Extract common operation of dedent and left strip
-rw-r--r--setuptools/tests/test_easy_install.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 1abb82fd..d915f3c5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -28,6 +28,14 @@ import pkg_resources
from .py26compat import tarfile_open
+
+def DALS(input):
+ """
+ Dedent and left-strip
+ """
+ return textwrap.dedent(input).lstrip()
+
+
class FakeDist(object):
def get_entry_map(self, group):
if group != 'console_scripts':
@@ -37,7 +45,7 @@ class FakeDist(object):
def as_requirement(self):
return 'spec'
-WANTED = textwrap.dedent("""
+WANTED = DALS("""
#!%s
# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
__requires__ = 'spec'
@@ -48,13 +56,13 @@ WANTED = textwrap.dedent("""
sys.exit(
load_entry_point('spec', 'console_scripts', 'name')()
)
- """).lstrip() % nt_quote_arg(fix_jython_executable(sys.executable, ""))
+ """) % nt_quote_arg(fix_jython_executable(sys.executable, ""))
-SETUP_PY = textwrap.dedent("""
+SETUP_PY = DALS("""
from setuptools import setup
setup(name='foo')
- """).lstrip()
+ """)
class TestEasyInstallTest(unittest.TestCase):
@@ -295,14 +303,14 @@ class TestSetupRequires(unittest.TestCase):
dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
make_trivial_sdist(
dist_path,
- textwrap.dedent("""
+ DALS("""
import setuptools
setuptools.setup(
name="setuptools-test-fetcher",
version="1.0",
setup_requires = ['does-not-exist'],
)
- """).lstrip())
+ """))
yield dist_path
def test_setup_requires_overrides_version_conflict(self):
@@ -357,7 +365,7 @@ def create_setup_requires_package(path):
os.mkdir(test_pkg)
with open(test_setup_py, 'w') as f:
- f.write(textwrap.dedent("""\
+ f.write(DALS("""
import setuptools
setuptools.setup(**%r)
""" % test_setup_attrs))
@@ -365,7 +373,7 @@ def create_setup_requires_package(path):
foobar_path = os.path.join(path, 'foobar-0.1.tar.gz')
make_trivial_sdist(
foobar_path,
- textwrap.dedent("""\
+ DALS("""
import setuptools
setuptools.setup(
name='foobar',