diff options
| author | Tarek Ziade <tarek@ziade.org> | 2010-05-06 18:10:32 +0200 |
|---|---|---|
| committer | Tarek Ziade <tarek@ziade.org> | 2010-05-06 18:10:32 +0200 |
| commit | 6a6a261fa50522d77fba6d6345fb71ba9f00c311 (patch) | |
| tree | 4d025291624e9ce33cfed1400b13907d8384d145 /setuptools/tests | |
| parent | 3cd5038930832fce95fb41d20150e173eb9894b5 (diff) | |
| download | python-setuptools-git-6a6a261fa50522d77fba6d6345fb71ba9f00c311.tar.gz | |
make sure all tests passes on all python versions fixes #149
--HG--
branch : distribute
extra : rebase_source : 6288f4fcf65083b9d4ffb0ea8b35af44e699b4d5
Diffstat (limited to 'setuptools/tests')
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 10 | ||||
| -rw-r--r-- | setuptools/tests/test_sandbox.py | 11 | ||||
| -rw-r--r-- | setuptools/tests/test_upload_docs.py | 22 |
3 files changed, 23 insertions, 20 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index f2655d75..e02798c6 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -122,19 +122,19 @@ class TestEasyInstallTest(unittest.TestCase): class TestPTHFileWriter(unittest.TestCase): def test_add_from_cwd_site_sets_dirty(self): - '''a pth file manager should set dirty + '''a pth file manager should set dirty if a distribution is in site but also the cwd ''' pth = PthDistributions('does-not_exist', [os.getcwd()]) - self.assertFalse(pth.dirty) + self.assert_(not pth.dirty) pth.add(PRDistribution(os.getcwd())) - self.assertTrue(pth.dirty) + self.assert_(pth.dirty) def test_add_from_site_is_ignored(self): pth = PthDistributions('does-not_exist', ['/test/location/does-not-have-to-exist']) - self.assertFalse(pth.dirty) + self.assert_(not pth.dirty) pth.add(PRDistribution('/test/location/does-not-have-to-exist')) - self.assertFalse(pth.dirty) + self.assert_(not pth.dirty) class TestUserInstallTest(unittest.TestCase): diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 8b9e08e6..1609ee86 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -30,10 +30,11 @@ class TestSandbox(unittest.TestCase): shutil.rmtree(self.dir) def test_devnull(self): + if sys.version < '2.4': + return sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull)) - @staticmethod def _file_writer(path): def do_write(): f = open(path, 'w') @@ -41,6 +42,7 @@ class TestSandbox(unittest.TestCase): f.close() return do_write + _file_writer = staticmethod(_file_writer) if has_win32com(): def test_win32com(self): @@ -53,9 +55,10 @@ class TestSandbox(unittest.TestCase): target = os.path.join(gen_py, 'test_write') sandbox = DirectorySandbox(self.dir) try: - sandbox.run(self._file_writer(target)) - except SandboxViolation: - self.fail("Could not create gen_py file due to SandboxViolation") + try: + sandbox.run(self._file_writer(target)) + except SandboxViolation: + self.fail("Could not create gen_py file due to SandboxViolation") finally: if os.path.exists(target): os.remove(target) diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 15db899f..8b2dc892 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -19,24 +19,24 @@ class TestUploadDocsTest(unittest.TestCase): f.close() self.old_cwd = os.getcwd() os.chdir(self.dir) - + self.upload_dir = os.path.join(self.dir, 'build') os.mkdir(self.upload_dir) - + # A test document. f = open(os.path.join(self.upload_dir, 'index.html'), 'w') f.write("Hello world.") f.close() - + # An empty folder. os.mkdir(os.path.join(self.upload_dir, 'empty')) - + if sys.version >= "2.6": self.old_base = site.USER_BASE site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp() self.old_site = site.USER_SITE site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp() - + def tearDown(self): os.chdir(self.old_cwd) shutil.rmtree(self.dir) @@ -49,17 +49,17 @@ class TestUploadDocsTest(unittest.TestCase): def test_create_zipfile(self): # Test to make sure zipfile creation handles common cases. # This explicitly includes a folder containing an empty folder. - + dist = Distribution() - + cmd = upload_docs(dist) cmd.upload_dir = self.upload_dir zip_file = cmd.create_zipfile() - + assert zipfile.is_zipfile(zip_file) - + zip_f = zipfile.ZipFile(zip_file) # woh... - + assert zip_f.namelist() == ['index.html'] - + |
