[Core] test_advanced_3.py::test_logging_to_driver (round 2) (#9916)

This commit is contained in:
Alex Wu
2020-08-05 13:04:36 -07:00
committed by GitHub
parent b6da7dcef9
commit 12d75784a4
3 changed files with 46 additions and 9 deletions
+8 -4
View File
@@ -202,17 +202,21 @@ def test_logging_to_driver(shutdown_only):
def f():
# It's important to make sure that these print statements occur even
# without calling sys.stdout.flush() and sys.stderr.flush().
for i in range(100):
print(i)
print(100 + i, file=sys.stderr)
for i in range(10):
print(i, end=" ")
print(100 + i, end=" ", file=sys.stderr)
captured = {}
with CaptureOutputAndError(captured):
ray.get(f.remote())
time.sleep(1)
out_lines = captured["out"]
err_lines = captured["err"]
for i in range(200):
for i in range(10):
assert str(i) in out_lines
for i in range(100, 110):
assert str(i) in err_lines