summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_core.py')
-rw-r--r--Lib/distutils/tests/test_core.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_core.py b/Lib/distutils/tests/test_core.py
index 7f021dc..b5f391f 100644
--- a/Lib/distutils/tests/test_core.py
+++ b/Lib/distutils/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)