Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
distutils.tests.test_core.CoreTestCase Class Reference
Inheritance diagram for distutils.tests.test_core.CoreTestCase:
Inheritance graph
[legend]
Collaboration diagram for distutils.tests.test_core.CoreTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def cleanup_testfn
def write_setup
def test_run_setup_provides_file
def test_run_setup_uses_current_dir
def test_debug_mode

Public Attributes

 old_stdout
 old_argv
 old_environ
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Definition at line 32 of file test_core.py.


Member Function Documentation

Definition at line 47 of file test_core.py.

00047 
00048     def cleanup_testfn(self):
00049         path = test.support.TESTFN
00050         if os.path.isfile(path):
00051             os.remove(path)
00052         elif os.path.isdir(path):
00053             shutil.rmtree(path)

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from distutils.tests.support.EnvironGuard.

Definition at line 34 of file test_core.py.

00034 
00035     def setUp(self):
00036         super(CoreTestCase, self).setUp()
00037         self.old_stdout = sys.stdout
00038         self.cleanup_testfn()
00039         self.old_argv = sys.argv, sys.argv[:]

Here is the caller graph for this function:

Reimplemented from distutils.tests.support.EnvironGuard.

Definition at line 40 of file test_core.py.

00040 
00041     def tearDown(self):
00042         sys.stdout = self.old_stdout
00043         self.cleanup_testfn()
00044         sys.argv = self.old_argv[0]
00045         sys.argv[:] = self.old_argv[1]
00046         super(CoreTestCase, self).tearDown()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file test_core.py.

00086 
00087     def test_debug_mode(self):
00088         # this covers the code called when DEBUG is set
00089         sys.argv = ['setup.py', '--name']
00090         with captured_stdout() as stdout:
00091             distutils.core.setup(name='bar')
00092         stdout.seek(0)
00093         self.assertEqual(stdout.read(), 'bar\n')
00094 
00095         distutils.core.DEBUG = True
00096         try:
00097             with captured_stdout() as stdout:
00098                 distutils.core.setup(name='bar')
00099         finally:
00100             distutils.core.DEBUG = False
00101         stdout.seek(0)
00102         wanted = "options (after parsing config files):\n"
00103         self.assertEqual(stdout.readlines()[0], wanted)

Here is the call graph for this function:

Definition at line 62 of file test_core.py.

00062 
00063     def test_run_setup_provides_file(self):
00064         # Make sure the script can use __file__; if that's missing, the test
00065         # setup.py script will raise NameError.
00066         distutils.core.run_setup(
00067             self.write_setup(setup_using___file__))

Here is the call graph for this function:

Definition at line 68 of file test_core.py.

00068 
00069     def test_run_setup_uses_current_dir(self):
00070         # This tests that the setup script is run with the current directory
00071         # as its own current directory; this was temporarily broken by a
00072         # previous patch when TESTFN did not use the current directory.
00073         sys.stdout = io.StringIO()
00074         cwd = os.getcwd()
00075 
00076         # Create a directory and write the setup.py file there:
00077         os.mkdir(test.support.TESTFN)
00078         setup_py = os.path.join(test.support.TESTFN, "setup.py")
00079         distutils.core.run_setup(
00080             self.write_setup(setup_prints_cwd, path=setup_py))
00081 
00082         output = sys.stdout.getvalue()
00083         if output.endswith("\n"):
00084             output = output[:-1]
00085         self.assertEqual(cwd, output)

Here is the call graph for this function:

Definition at line 54 of file test_core.py.

00054 
00055     def write_setup(self, text, path=test.support.TESTFN):
00056         f = open(path, "w")
00057         try:
00058             f.write(text)
00059         finally:
00060             f.close()
00061         return path

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 38 of file test_core.py.

Definition at line 125 of file support.py.

Definition at line 36 of file test_core.py.


The documentation for this class was generated from the following file: