Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: recipe_engine/third_party/setuptools/tests/test_bdist_egg.py

Issue 1344583003: Recipe package system. (Closed) Base URL: git@github.com:luci/recipes-py.git@master
Patch Set: Recompiled proto Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 """develop tests
2 """
3 import os
4 import re
5 import shutil
6 import site
7 import sys
8 import tempfile
9 import unittest
10
11 from distutils.errors import DistutilsError
12 from setuptools.compat import StringIO
13 from setuptools.command.bdist_egg import bdist_egg
14 from setuptools.command import easy_install as easy_install_pkg
15 from setuptools.dist import Distribution
16
17 SETUP_PY = """\
18 from setuptools import setup
19
20 setup(name='foo', py_modules=['hi'])
21 """
22
23 class TestDevelopTest(unittest.TestCase):
24
25 def setUp(self):
26 self.dir = tempfile.mkdtemp()
27 self.old_cwd = os.getcwd()
28 os.chdir(self.dir)
29 f = open('setup.py', 'w')
30 f.write(SETUP_PY)
31 f.close()
32 f = open('hi.py', 'w')
33 f.write('1\n')
34 f.close()
35 if sys.version >= "2.6":
36 self.old_base = site.USER_BASE
37 site.USER_BASE = tempfile.mkdtemp()
38 self.old_site = site.USER_SITE
39 site.USER_SITE = tempfile.mkdtemp()
40
41 def tearDown(self):
42 os.chdir(self.old_cwd)
43 shutil.rmtree(self.dir)
44 if sys.version >= "2.6":
45 shutil.rmtree(site.USER_BASE)
46 shutil.rmtree(site.USER_SITE)
47 site.USER_BASE = self.old_base
48 site.USER_SITE = self.old_site
49
50 def test_bdist_egg(self):
51 dist = Distribution(dict(
52 script_name='setup.py',
53 script_args=['bdist_egg'],
54 name='foo',
55 py_modules=['hi']
56 ))
57 os.makedirs(os.path.join('build', 'src'))
58 old_stdout = sys.stdout
59 sys.stdout = o = StringIO()
60 try:
61 dist.parse_command_line()
62 dist.run_commands()
63 finally:
64 sys.stdout = old_stdout
65
66 # let's see if we got our egg link at the right place
67 [content] = os.listdir('dist')
68 self.assertTrue(re.match('foo-0.0.0-py[23].\d.egg$', content))
69
70 def test_suite():
71 return unittest.makeSuite(TestDevelopTest)
72
OLDNEW
« no previous file with comments | « recipe_engine/third_party/setuptools/tests/server.py ('k') | recipe_engine/third_party/setuptools/tests/test_build_ext.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698