Skip to content

Commit 2e26d50

Browse files
author
DrGeoff
committed
Permanently enable the cppdeps test
1 parent f29ae33 commit 2e26d50

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ct/test_cppdeps.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import unittest
44
import shutil
55
import tempfile
6+
import io
7+
from contextlib import redirect_stdout
68

79
try:
810
# This call to reload is simply to test
@@ -28,20 +30,18 @@ class TestCPPDeps(unittest.TestCase):
2830
def setUp(self):
2931
uth.reset()
3032

31-
# This test needs to run in buffered mode.
32-
# You can set buffer through unit2 command line flag -b, --buffer
33-
# or in unittest.main options.
34-
@unittest.skipIf(
35-
not hasattr(sys.stdout, "getvalue"), "Skipping test since not in buffer mode"
36-
)
3733
def test_cppdeps(self):
3834
tempdir = tempfile.mkdtemp()
3935
_reload_ct(tempdir)
4036
uth.reset()
41-
ct.cppdeps.main(
42-
[os.path.join(uth.samplesdir(), "numbers/test_direct_include.cpp")]
43-
)
44-
output = sys.stdout.getvalue().strip().split()
37+
38+
output_buffer = io.StringIO()
39+
with redirect_stdout(output_buffer):
40+
ct.cppdeps.main(
41+
[os.path.join(uth.samplesdir(), "numbers/test_direct_include.cpp")]
42+
)
43+
44+
output = output_buffer.getvalue().strip().split()
4545
expected_output = [
4646
os.path.join(uth.samplesdir(), "numbers/get_double.hpp"),
4747
os.path.join(uth.samplesdir(), "numbers/get_int.hpp"),

0 commit comments

Comments
 (0)