diff --git a/tests/snippets/test_threading.py b/tests/snippets/test_threading.py index e00d1835f..41024b360 100644 --- a/tests/snippets/test_threading.py +++ b/tests/snippets/test_threading.py @@ -5,17 +5,20 @@ output = [] def thread_function(name): - output.append("Thread %s: starting" % name) + output.append((name, 0)) time.sleep(2.0) - output.append("Thread %s: finishing" % name) + output.append((name, 1)) -output.append("Main : before creating thread") +output.append((0, 0)) x = threading.Thread(target=thread_function, args=(1, )) -output.append("Main : before running thread") +output.append((0, 1)) x.start() -output.append("Main : wait for the thread to finish") +output.append((0, 2)) x.join() -output.append("Main : all done") +output.append((0, 3)) assert len(output) == 6, output +# CPython has [(1, 0), (0, 2)] for the middle 2, but we have [(0, 2), (1, 0)] +# TODO: maybe fix this, if it turns out to be a problem? +# assert output == [(0, 0), (0, 1), (1, 0), (0, 2), (1, 1), (0, 3)]