diff options
author | Éric Araujo <merwok@netwok.org> | 2011-11-06 10:32:47 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-11-06 10:32:47 (GMT) |
commit | fad46e19b4e6b2173b84e6216465e6fe5824ba2a (patch) | |
tree | 5fc4bb7de10764e1f7276072681892d65ea6d9e1 /Lib/packaging/tests/test_command_build_py.py | |
parent | 261ccdce4825535d4f6ea4bf09e9394bb751df20 (diff) | |
download | cpython-fad46e19b4e6b2173b84e6216465e6fe5824ba2a.zip cpython-fad46e19b4e6b2173b84e6216465e6fe5824ba2a.tar.gz cpython-fad46e19b4e6b2173b84e6216465e6fe5824ba2a.tar.bz2 |
Clean up mocking of stdout and stdin in packaging tests.
Running with regrtest does not show spurious output or unrestored
sys.std* objects; sometimes running with make test is different, I’ll
watch the buildbots.
In addition, update the create module to use logging.
Diffstat (limited to 'Lib/packaging/tests/test_command_build_py.py')
-rw-r--r-- | Lib/packaging/tests/test_command_build_py.py | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/Lib/packaging/tests/test_command_build_py.py b/Lib/packaging/tests/test_command_build_py.py index 4d93faa..f7f26da 100644 --- a/Lib/packaging/tests/test_command_build_py.py +++ b/Lib/packaging/tests/test_command_build_py.py @@ -67,8 +67,6 @@ class BuildPyTestCase(support.TempdirManager, def test_empty_package_dir(self): # See SF 1668596/1720897. - cwd = os.getcwd() - # create the distribution files. sources = self.mkdtemp() pkg = os.path.join(sources, 'pkg') @@ -79,24 +77,16 @@ class BuildPyTestCase(support.TempdirManager, open(os.path.join(testdir, "testfile"), "wb").close() os.chdir(sources) - old_stdout = sys.stdout - #sys.stdout = StringIO.StringIO() + dist = Distribution({"packages": ["pkg"], + "package_dir": sources, + "package_data": {"pkg": ["doc/*"]}}) + dist.script_args = ["build"] + dist.parse_command_line() try: - dist = Distribution({"packages": ["pkg"], - "package_dir": sources, - "package_data": {"pkg": ["doc/*"]}}) - dist.script_args = ["build"] - dist.parse_command_line() - - try: - dist.run_commands() - except PackagingFileError: - self.fail("failed package_data test when package_dir is ''") - finally: - # Restore state. - os.chdir(cwd) - sys.stdout = old_stdout + dist.run_commands() + except PackagingFileError: + self.fail("failed package_data test when package_dir is ''") def test_byte_compile(self): project_dir, dist = self.create_dist(py_modules=['boiledeggs']) |