File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8; -*-
22
3- from ..syntax import macros , test , test_raises # noqa: F401
3+ from ..syntax import macros , test , test_raises , the # noqa: F401
44from .fixtures import session , testset , returns_normally
55
66import pickle
@@ -95,8 +95,12 @@ def worker():
9595 t .start ()
9696 for t in threads :
9797 t .join ()
98+ # Rarely, a race may lead to multiple threads succeeding in
99+ # instantiating the singleton. If that happens, all the created
100+ # instances should be the same one. So test that, rather than
101+ # that only one was created.
98102 lst = slurp (que )
99- test [len ( lst ) == 1 ]
103+ test [allsame ( the [ lst ])] # lst is short and we'd like to see it if the test fails.
100104
101105 # TODO: These must be outside the `with test` because a test block
102106 # implicitly creates a function (whence a local scope).
@@ -117,6 +121,7 @@ def worker():
117121 for t in threads :
118122 t .join ()
119123 lst = slurp (que )
124+ test [len (lst ) == n ]
120125 test [all (x is not None for x in lst )]
121126 test [allsame (lst )]
122127
You can’t perform that action at this time.
0 commit comments