aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-09-13 14:28:34 +0200
committerMartin v. Löwis <martin@v.loewis.de>2009-09-13 14:28:34 +0200
commit3c6ebb2ab608930ea3d1e54476344a990526e64a (patch)
treeedfddb93275be90c0e2effd551e3669bfbcd1347 /tests
parent5bf298f0e8b30f236b76997c66eee38de798f710 (diff)
parent28c9b94a4da7a469bb726309bce461dd0843e744 (diff)
downloadexternal_python_setuptools-3c6ebb2ab608930ea3d1e54476344a990526e64a.tar.gz
external_python_setuptools-3c6ebb2ab608930ea3d1e54476344a990526e64a.tar.bz2
external_python_setuptools-3c6ebb2ab608930ea3d1e54476344a990526e64a.zip
Merge upstream changes.
--HG-- branch : distribute extra : rebase_source : 4f43f59bf581c692bfbe4b45a8567b089fa0173a
Diffstat (limited to 'tests')
-rw-r--r--tests/test_distribute_setup.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/test_distribute_setup.py b/tests/test_distribute_setup.py
new file mode 100644
index 00000000..6c004bd7
--- /dev/null
+++ b/tests/test_distribute_setup.py
@@ -0,0 +1,61 @@
+import sys
+import os
+import tempfile
+import unittest
+import shutil
+import copy
+
+CURDIR = os.path.abspath(os.path.dirname(__file__))
+TOPDIR = os.path.split(CURDIR)[0]
+sys.path.insert(0, TOPDIR)
+
+from distribute_setup import (use_setuptools, _build_egg, python_cmd,
+ _do_download, _install)
+import distribute_setup
+
+class TestSetup(unittest.TestCase):
+
+ def urlopen(self, url):
+ return open(self.tarball)
+
+ def setUp(self):
+ self.old_sys_path = copy.copy(sys.path)
+ self.cwd = os.getcwd()
+ self.tmpdir = tempfile.mkdtemp()
+ os.chdir(TOPDIR)
+ python_cmd("setup.py -q egg_info -RDb '' sdist --dist-dir %s" % \
+ self.tmpdir)
+ tarball = os.listdir(self.tmpdir)[0]
+ self.tarball = os.path.join(self.tmpdir, tarball)
+ import urllib2
+ urllib2.urlopen = self.urlopen
+
+ def tearDown(self):
+ shutil.rmtree(self.tmpdir)
+ os.chdir(self.cwd)
+ sys.path = copy.copy(self.old_sys_path)
+
+ def test_build_egg(self):
+ # making it an egg
+ egg = _build_egg(self.tarball, self.tmpdir)
+
+ # now trying to import it
+ sys.path[0] = egg
+ import setuptools
+ self.assert_(setuptools.__file__.startswith(egg))
+
+ def test_do_download(self):
+
+ tmpdir = tempfile.mkdtemp()
+ _do_download(to_dir=tmpdir)
+ import setuptools
+ self.assert_(setuptools.bootstrap_install_from.startswith(tmpdir))
+
+ def test_install(self):
+ def _faked(*args):
+ return True
+ distribute_setup.python_cmd = _faked
+ _install(self.tarball)
+
+if __name__ == '__main__':
+ unittest.main()