summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/tests/test_cmd.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-11-13 14:37:35 -0500
committerJason R. Coombs <jaraco@jaraco.com>2022-11-13 14:37:35 -0500
commit9b8a6ef60b2b490bcf60b9dd7f0d43d46f49e489 (patch)
tree56b90c20f19ca92c8d9c26e782c5969a7b872c48 /setuptools/_distutils/tests/test_cmd.py
parenta0e8e53cecc238e3bce2247308fe7dd94114ef35 (diff)
parente0787fad7c03d8defbbaaaf2888130cc2a171537 (diff)
downloadpython-setuptools-git-9b8a6ef60b2b490bcf60b9dd7f0d43d46f49e489.tar.gz
Merge https://github.com/pypa/distutils into distutils-e0787fa
Diffstat (limited to 'setuptools/_distutils/tests/test_cmd.py')
-rw-r--r--setuptools/_distutils/tests/test_cmd.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/setuptools/_distutils/tests/test_cmd.py b/setuptools/_distutils/tests/test_cmd.py
index e4d5bf3c..3aac448d 100644
--- a/setuptools/_distutils/tests/test_cmd.py
+++ b/setuptools/_distutils/tests/test_cmd.py
@@ -1,6 +1,5 @@
"""Tests for distutils.cmd."""
import os
-from test.support import captured_stdout
from distutils.cmd import Command
from distutils.dist import Distribution
@@ -100,17 +99,9 @@ class TestCommand:
with pytest.raises(DistutilsOptionError):
cmd.ensure_dirname('option2')
- def test_debug_print(self, cmd):
- with captured_stdout() as stdout:
- cmd.debug_print('xxx')
- stdout.seek(0)
- assert stdout.read() == ''
-
- debug.DEBUG = True
- try:
- with captured_stdout() as stdout:
- cmd.debug_print('xxx')
- stdout.seek(0)
- assert stdout.read() == 'xxx\n'
- finally:
- debug.DEBUG = False
+ def test_debug_print(self, cmd, capsys, monkeypatch):
+ cmd.debug_print('xxx')
+ assert capsys.readouterr().out == ''
+ monkeypatch.setattr(debug, 'DEBUG', True)
+ cmd.debug_print('xxx')
+ assert capsys.readouterr().out == 'xxx\n'