File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1403,28 +1403,36 @@ def test_capattr():
1403
1403
1404
1404
1405
1405
def test_crash_on_closing_tmpfile_py27 (testdir ):
1406
- testdir .makepyfile (
1406
+ p = testdir .makepyfile (
1407
1407
"""
1408
1408
from __future__ import print_function
1409
- import time
1410
1409
import threading
1411
1410
import sys
1412
1411
1412
+ printing = threading.Event()
1413
+
1413
1414
def spam():
1414
1415
f = sys.stderr
1416
+ print('SPAMBEFORE', end='', file=f)
1417
+ printing.set()
1418
+
1415
1419
while True:
1416
- print('.', end='', file=f)
1420
+ try:
1421
+ f.flush()
1422
+ except (OSError, ValueError):
1423
+ break
1417
1424
1418
- def test_silly ():
1425
+ def test_spam_in_thread ():
1419
1426
t = threading.Thread(target=spam)
1420
1427
t.daemon = True
1421
1428
t.start()
1422
- time.sleep(0.5)
1423
1429
1430
+ printing.wait()
1424
1431
"""
1425
1432
)
1426
- result = testdir .runpytest_subprocess ()
1433
+ result = testdir .runpytest_subprocess (str ( p ) )
1427
1434
assert result .ret == 0
1435
+ assert result .stderr .str () == ""
1428
1436
assert "IOError" not in result .stdout .str ()
1429
1437
1430
1438
You can’t perform that action at this time.
0 commit comments