File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1263,6 +1263,26 @@ def test_2():
12631263 assert a .items () == b .items ()
12641264 assert c1 == c2
12651265
1266+ def test_single_scope_all_workers_utilized (self , pytester : pytest .Pytester ) -> None :
1267+ """
1268+ With single scope, there are no fence tests from another scope, so
1269+ this scheduler resorts to shutting down the workers in order to execute
1270+ the final tests in each worker. isoscope allocates at least two tests
1271+ per worker from the active scope, unless the scope has only one test.
1272+ """
1273+ test_file = """
1274+ import pytest
1275+ @pytest.mark.parametrize('i', range(5))
1276+ def test(i):
1277+ pass
1278+ """
1279+ pytester .makepyfile (test_a = test_file )
1280+ result = pytester .runpytest ("-n2" , "--dist=isoscope" , "-v" )
1281+ counts_by_worker = get_workers_and_test_count_by_prefix ("test_a.py::test" , result .outlines )
1282+ assert counts_by_worker ["gw0" ] in (2 , 3 )
1283+ assert counts_by_worker ["gw1" ] in (2 , 3 )
1284+ assert counts_by_worker ["gw0" ] + counts_by_worker ["gw1" ] == 5
1285+
12661286
12671287class TestLoadScope :
12681288 def test_by_module (self , pytester : pytest .Pytester ) -> None :
You can’t perform that action at this time.
0 commit comments