diff options
author | Philip Thiem <ptthiem@gmail.com> | 2013-11-11 17:07:52 -0600 |
---|---|---|
committer | Philip Thiem <ptthiem@gmail.com> | 2013-11-11 17:07:52 -0600 |
commit | 76423012b5b51691dd059b1276351099e52c787e (patch) | |
tree | 85d004d9b7f0c838a52597546869cc5185f5f4a0 /setuptools/tests/test_sdist.py | |
parent | ba9d35158fe8f4af6a2b19e84a2eaca718a93e03 (diff) | |
download | external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.tar.gz external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.tar.bz2 external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.zip |
For .svn legacy fallback, look for the files in the .svn not the directory.
(Fixed unexpected deprecation warning from prombredanne)
Also removed the warning from fallback, only a deprecation warning is issued.
Environment.py whitespacing
Created a specialized command executor for tests in Environment.py
Legacy Test in test_egg_info now supresses the deprecation warning.
PythonPath is now explicitly controlled to allow setup.py test on clean
python installations. *Fixes Issue #101*
Moved some dummy svn tests from test_sdist to test_egg_info since
they are egg_info tests.
Downgraded a with statement in a test since we haven't offically dropped
2.4 support, however, maybe it is time.
Added a test case to ensure no extranuous output on sdist with a simple
dummy package without rev ctrl.
Diffstat (limited to 'setuptools/tests/test_sdist.py')
-rw-r--r-- | setuptools/tests/test_sdist.py | 149 |
1 files changed, 70 insertions, 79 deletions
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 716893dc..b42dcc57 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- """sdist tests""" -from __future__ import with_statement import locale import os import shutil @@ -401,81 +400,73 @@ class TestSdistTest(unittest.TestCase): self.assertTrue(filename in cmd.filelist.files) -def soruce_test(self): - code, data = svn_utils._run_command([sys.executable, "setup.py", "egg_info"], stream=1) - - if code: - raise AssertionError(data) - - sources = os.path.join('dummy.egg-info', 'SOURCES.txt') - contents = """CHANGES.txt -CONTRIBUTORS.txt -HISTORY.txt -LICENSE -MANIFEST.in -README.txt -setup.py -dummy/__init__.py -dummy/test.txt -dummy.egg-info/PKG-INFO -dummy.egg-info/SOURCES.txt -dummy.egg-info/dependency_links.txt -dummy.egg-info/top_level.txt""" - - with open(sources, 'r') as infile: - read_contents = infile.read() - - self.assertEqual(contents, read_contents) - - -class TestSvnDummy(environment.ZippedEnvironment): - - def setUp(self): - version = svn_utils.SvnInfo.get_svn_version() - self.base_version = tuple([int(x) for x in version.split('.')][:2]) - - if not self.base_version: - raise ValueError('No SVN tools installed') - elif self.base_version < (1,3): - raise ValueError('Insufficient SVN Version %s' % version) - elif self.base_version >= (1,9): - #trying the latest version - self.base_version = (1,8) - - self.dataname = "dummy%i%i" % self.base_version - self.datafile = os.path.join('setuptools', 'tests', - 'svn_data', self.dataname + ".zip") - super(TestSvnDummy, self).setUp() - - def test_sources(self): - soruce_test(self) - - -class TestSvnDummyLegacy(environment.ZippedEnvironment): +class TestDummyOutput(environment.ZippedEnvironment): def setUp(self): - self.base_version = (1,6) - self.path_variable = None - for env in os.environ: - if env.lower() == 'path': - self.path_variable = env - self.old_path = os.environ[self.path_variable] - os.environ[self.path_variable] = '' - - if self.path_variable is None: - self.skipTest('Cannot figure out how to modify path') - - self.dataname = "dummy%i%i" % self.base_version self.datafile = os.path.join('setuptools', 'tests', - 'svn_data', self.dataname + ".zip") - super(TestSvnDummyLegacy, self).setUp() - - def tearDown(self): - os.environ[self.path_variable] = self.old_path - super(TestSvnDummyLegacy, self).tearDown() + 'svn_data', "dummy.zip") + self.dataname = "dummy" + super(TestDummyOutput, self).setUp() + + def _run(self): + code, data = environment.run_setup_py(["sdist"], + pypath=self.old_cwd, + data_stream=0) + if code: + info = "DIR: " + os.path.abspath('.') + info += "\n SDIST RETURNED: %i\n\n" % code + info += data + raise AssertionError(info) + + datalines = data.splitlines() + + possible = ( + "running sdist", + "running egg_info", + "creating dummy\.egg-info", + "writing dummy\.egg-info", + "writing top-level names to dummy\.egg-info", + "writing dependency_links to dummy\.egg-info", + "writing manifest file 'dummy\.egg-info", + "reading manifest file 'dummy\.egg-info", + "reading manifest template 'MANIFEST\.in'", + "writing manifest file 'dummy\.egg-info", + "creating dummy-0.1.1", + "making hard links in dummy-0\.1\.1", + "copying files to dummy-0\.1\.1", + "copying \S+ -> dummy-0\.1\.1", + "copying dummy", + "copying dummy\.egg-info", + "hard linking \S+ -> dummy-0\.1\.1", + "hard linking dummy", + "hard linking dummy\.egg-info", + "Writing dummy-0\.1\.1", + "creating dist", + "creating 'dist", + "Creating tar archive", + "running check", + "adding 'dummy-0\.1\.1", + "tar .+ dist/dummy-0\.1\.1\.tar dummy-0\.1\.1", + "gzip .+ dist/dummy-0\.1\.1\.tar", + "removing 'dummy-0\.1\.1' \\(and everything under it\\)", + ) + + print(" DIR: " + os.path.abspath('.')) + for line in datalines: + found = False + for pattern in possible: + if re.match(pattern, line): + print(" READ: " + line) + found = True + break + if not found: + raise AssertionError("Unexpexected: %s\n-in-\n%s" + % (line, data)) + + return data def test_sources(self): - soruce_test(self) + self._run() class TestSvn(environment.ZippedEnvironment): @@ -486,11 +477,11 @@ class TestSvn(environment.ZippedEnvironment): if not self.base_version: raise ValueError('No SVN tools installed') - elif self.base_version < (1,3): + elif self.base_version < (1, 3): raise ValueError('Insufficient SVN Version %s' % version) - elif self.base_version >= (1,9): + elif self.base_version >= (1, 9): #trying the latest version - self.base_version = (1,8) + self.base_version = (1, 8) self.dataname = "svn%i%i_example" % self.base_version self.datafile = os.path.join('setuptools', 'tests', @@ -498,7 +489,7 @@ class TestSvn(environment.ZippedEnvironment): super(TestSvn, self).setUp() def test_walksvn(self): - if self.base_version >= (1,6): + if self.base_version >= (1, 6): folder2 = 'third party2' folder3 = 'third party3' else: @@ -520,7 +511,7 @@ class TestSvn(environment.ZippedEnvironment): os.path.join('folder', folder2, 'Changes.txt'), os.path.join('folder', folder2, 'MD5SUMS'), os.path.join('folder', folder2, 'WatashiNiYomimasu.txt'), - os.path.join( 'folder', folder3, 'Changes.txt'), + os.path.join('folder', folder3, 'Changes.txt'), os.path.join('folder', folder3, 'fin'), os.path.join('folder', folder3, 'MD5SUMS'), os.path.join('folder', folder3, 'oops'), @@ -529,11 +520,11 @@ class TestSvn(environment.ZippedEnvironment): os.path.join('folder', 'third_party', 'WatashiNiYomimasu.txt'), os.path.join('folder', 'lalala.txt'), os.path.join('folder', 'quest.txt'), - #The example will have a deleted file (or should) but shouldn't return it - ]) + # The example will have a deleted file + # (or should) but shouldn't return it + ]) self.assertEqual(set(x for x in walk_revctrl()), expected) def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) - |