diff options
| author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 +0000 |
|---|---|---|
| committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 +0000 |
| commit | f0f1b0325d3f06a06ab03c6912ea9743e9c30ff2 (patch) | |
| tree | e9b194d929f4a60a359fa993cc612cbef8b75935 /tests/test_core.py | |
| parent | 589e2a746f2e3812fe1e7840391a61b20b3fdaf4 (diff) | |
| download | python-setuptools-git-f0f1b0325d3f06a06ab03c6912ea9743e9c30ff2.tar.gz | |
Merged revisions 74988 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74988 | tarek.ziade | 2009-09-21 14:19:07 +0200 (Mon, 21 Sep 2009) | 1 line
improved distutils test coverage: now the DEBUG mode is covered too (will help fix the issue #6954 in py3k branch)
........
Diffstat (limited to 'tests/test_core.py')
| -rw-r--r-- | tests/test_core.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 7f021dcb..b5f391f5 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -6,6 +6,7 @@ import os import shutil import sys import test.support +from test.support import captured_stdout import unittest @@ -33,10 +34,12 @@ class CoreTestCase(unittest.TestCase): def setUp(self): self.old_stdout = sys.stdout self.cleanup_testfn() + self.old_argv = sys.argv[:] def tearDown(self): sys.stdout = self.old_stdout self.cleanup_testfn() + sys.argv = self.old_argv[:] def cleanup_testfn(self): path = test.support.TESTFN @@ -73,6 +76,23 @@ class CoreTestCase(unittest.TestCase): output = output[:-1] self.assertEqual(cwd, output) + def test_debug_mode(self): + # this covers the code called when DEBUG is set + sys.argv = ['setup.py', '--name'] + with captured_stdout() as stdout: + distutils.core.setup(name='bar') + stdout.seek(0) + self.assertEquals(stdout.read(), 'bar\n') + + distutils.core.DEBUG = True + try: + with captured_stdout() as stdout: + distutils.core.setup(name='bar') + finally: + distutils.core.DEBUG = False + stdout.seek(0) + wanted = "options (after parsing config files):\n" + self.assertEquals(stdout.readlines()[0], wanted) def test_suite(): return unittest.makeSuite(CoreTestCase) |
