diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2013-06-18 08:44:39 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-06-18 08:44:39 -0500 |
| commit | fb8c7cf0abc9ce58b8a6f0621c0a9909fb9b8eff (patch) | |
| tree | 95cae06260f49e011fc045000fc1531dbc0e0cf5 /setuptools/tests/test_bdist_egg.py | |
| parent | 32ba6930fa97bbeac9392cac3ed49aac87fd1018 (diff) | |
| parent | db678072da41b75408680dab3e23c1b76573bf1d (diff) | |
| download | python-setuptools-git-fb8c7cf0abc9ce58b8a6f0621c0a9909fb9b8eff.tar.gz | |
Merge with upstream
--HG--
branch : distribute
Diffstat (limited to 'setuptools/tests/test_bdist_egg.py')
| -rw-r--r-- | setuptools/tests/test_bdist_egg.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py new file mode 100644 index 00000000..7da122cc --- /dev/null +++ b/setuptools/tests/test_bdist_egg.py @@ -0,0 +1,69 @@ +"""develop tests +""" +import sys +import os, re, shutil, tempfile, unittest +import tempfile +import site +from StringIO import StringIO + +from distutils.errors import DistutilsError +from setuptools.command.bdist_egg import bdist_egg +from setuptools.command import easy_install as easy_install_pkg +from setuptools.dist import Distribution + +SETUP_PY = """\ +from setuptools import setup + +setup(name='foo', py_modules=['hi']) +""" + +class TestDevelopTest(unittest.TestCase): + + def setUp(self): + self.dir = tempfile.mkdtemp() + self.old_cwd = os.getcwd() + os.chdir(self.dir) + f = open('setup.py', 'w') + f.write(SETUP_PY) + f.close() + f = open('hi.py', 'w') + f.write('1\n') + f.close() + if sys.version >= "2.6": + self.old_base = site.USER_BASE + site.USER_BASE = tempfile.mkdtemp() + self.old_site = site.USER_SITE + site.USER_SITE = tempfile.mkdtemp() + + def tearDown(self): + os.chdir(self.old_cwd) + shutil.rmtree(self.dir) + if sys.version >= "2.6": + shutil.rmtree(site.USER_BASE) + shutil.rmtree(site.USER_SITE) + site.USER_BASE = self.old_base + site.USER_SITE = self.old_site + + def test_bdist_egg(self): + dist = Distribution(dict( + script_name='setup.py', + script_args=['bdist_egg'], + name='foo', + py_modules=['hi'] + )) + os.makedirs(os.path.join('build', 'src')) + old_stdout = sys.stdout + sys.stdout = o = StringIO() + try: + dist.parse_command_line() + dist.run_commands() + finally: + sys.stdout = old_stdout + + # let's see if we got our egg link at the right place + [content] = os.listdir('dist') + self.assertTrue(re.match('foo-0.0.0-py[23].\d.egg$', content)) + +def test_suite(): + return unittest.makeSuite(TestDevelopTest) + |
