Project Name: getsentry+responses
Language: Python
Statement Type: Constant Assignment

Source Code:
def test_multithreading_lock(execution_number):  # type: ignore[misc]
    """Reruns test multiple times since error is random and
    depends on CPU and can lead to false positive result.

    """
    n_threads = 10
    n_requests = 30
    with responses.RequestsMock() as m:
        for j in range(n_threads):
            for i in range(n_requests):
                m.add(url=f"http://example.com/example{i}", method="GET")

        def fun():
            for req in range(n_requests):
                requests.get(f"http://example.com/example{req}")

        threads = [
            threading.Thread(name=f"example{i}", target=fun) for i in range(n_threads)
        ]
        for thread in threads:
            thread.start()
        for thread in threads:
            thread.join()

test_multithreading_lock(execution_number=0)

Selected Statement: n_threads = 10

Function Input:
execution_number: 0

Variable Values Before Statement:
Constant: 10

Value After Statement Execution: 10

Variable States During Runtime (line, value):
execution_number: 1
0
n_threads: 6
10
n_requests: 7
30
m: 8
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<unlocked _thread.lock object at 0x7f684a53b390>}
21
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<locked _thread.lock object at 0x7f684a53b390>}
21
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<unlocked _thread.lock object at 0x7f684a53b390>}
21
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<locked _thread.lock object at 0x7f684a53b390>}
21
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<unlocked _thread.lock object at 0x7f684a53b390>}
21
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<locked _thread.lock object at 0x7f684a53b390>}
23
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f684a53be80>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=<unittest.mock._patch object at 0x7f6849be1af0>, _thread_lock=<unlocked _thread.lock object at 0x7f684a53b390>}
22
{_calls=<responses.CallList object at 0x7f684a53bee0>, _registry=<responses.registries.FirstMatchRegistry object at 0x7f6838645a60>, passthru_prefixes=(), assert_all_requests_are_fired=True, response_callback=None, target='requests.adapters.HTTPAdapter.send', _patcher=None, _thread_lock=<unlocked _thread.lock object at 0x7f684a53b390>}
j: 9
0
9
1
9
2
9
3
9
4
9
5
9
6
9
7
9
8
9
9
i: 10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
10
0
10
1
10
2
10
3
10
4
10
5
10
6
10
7
10
8
10
9
10
10
10
11
10
12
10
13
10
14
10
15
10
16
10
17
10
18
10
19
10
20
10
21
10
22
10
23
10
24
10
25
10
26
10
27
10
28
10
29
fun: 13
<function test_multithreading_lock.<locals>.fun at 0x7f683d0139d0>
threads: 17
[<Thread(example0, initial)>, <Thread(example1, initial)>, <Thread(example2, initial)>, <Thread(example3, initial)>, <Thread(example4, initial)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, initial)>, <Thread(example2, initial)>, <Thread(example3, initial)>, <Thread(example4, initial)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, initial)>, <Thread(example3, initial)>, <Thread(example4, initial)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, initial)>, <Thread(example4, initial)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, initial)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, initial)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, started 140085624665664)>, <Thread(example6, initial)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, started 140085624665664)>, <Thread(example6, started 140085616272960)>, <Thread(example7, initial)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, started 140085624665664)>, <Thread(example6, started 140085616272960)>, <Thread(example7, started 140085607880256)>, <Thread(example8, initial)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, started 140085624665664)>, <Thread(example6, started 140085616272960)>, <Thread(example7, started 140085607880256)>, <Thread(example8, started 140085123085888)>, <Thread(example9, initial)>]
21
[<Thread(example0, started 140085666891328)>, <Thread(example1, started 140085658236480)>, <Thread(example2, started 140085649843776)>, <Thread(example3, started 140085641451072)>, <Thread(example4, started 140085633058368)>, <Thread(example5, started 140085624665664)>, <Thread(example6, started 140085616272960)>, <Thread(example7, started 140085607880256)>, <Thread(example8, started 140085123085888)>, <Thread(example9, started 140085114693184)>]
23
[<Thread(example0, stopped 140085666891328)>, <Thread(example1, stopped 140085658236480)>, <Thread(example2, stopped 140085649843776)>, <Thread(example3, stopped 140085641451072)>, <Thread(example4, stopped 140085633058368)>, <Thread(example5, stopped 140085624665664)>, <Thread(example6, stopped 140085616272960)>, <Thread(example7, stopped 140085607880256)>, <Thread(example8, started 140085123085888)>, <Thread(example9, started 140085114693184)>]
23
[<Thread(example0, stopped 140085666891328)>, <Thread(example1, stopped 140085658236480)>, <Thread(example2, stopped 140085649843776)>, <Thread(example3, stopped 140085641451072)>, <Thread(example4, stopped 140085633058368)>, <Thread(example5, stopped 140085624665664)>, <Thread(example6, stopped 140085616272960)>, <Thread(example7, stopped 140085607880256)>, <Thread(example8, stopped 140085123085888)>, <Thread(example9, started 140085114693184)>]
23
[<Thread(example0, stopped 140085666891328)>, <Thread(example1, stopped 140085658236480)>, <Thread(example2, stopped 140085649843776)>, <Thread(example3, stopped 140085641451072)>, <Thread(example4, stopped 140085633058368)>, <Thread(example5, stopped 140085624665664)>, <Thread(example6, stopped 140085616272960)>, <Thread(example7, stopped 140085607880256)>, <Thread(example8, stopped 140085123085888)>, <Thread(example9, stopped 140085114693184)>]
thread: 20
<Thread(example0, initial)>
21
<Thread(example0, started 140085666891328)>
20
<Thread(example1, initial)>
21
<Thread(example1, started 140085658236480)>
20
<Thread(example2, initial)>
21
<Thread(example2, started 140085649843776)>
20
<Thread(example3, initial)>
21
<Thread(example3, started 140085641451072)>
20
<Thread(example4, initial)>
21
<Thread(example4, started 140085633058368)>
20
<Thread(example5, initial)>
21
<Thread(example5, started 140085624665664)>
20
<Thread(example6, initial)>
21
<Thread(example6, started 140085616272960)>
20
<Thread(example7, initial)>
21
<Thread(example7, started 140085607880256)>
20
<Thread(example8, initial)>
21
<Thread(example8, started 140085123085888)>
20
<Thread(example9, initial)>
21
<Thread(example9, started 140085114693184)>
22
<Thread(example0, started 140085666891328)>
23
<Thread(example0, stopped 140085666891328)>
22
<Thread(example1, stopped 140085658236480)>
22
<Thread(example2, stopped 140085649843776)>
22
<Thread(example3, stopped 140085641451072)>
22
<Thread(example4, stopped 140085633058368)>
22
<Thread(example5, stopped 140085624665664)>
22
<Thread(example6, stopped 140085616272960)>
22
<Thread(example7, stopped 140085607880256)>
22
<Thread(example8, started 140085123085888)>
23
<Thread(example8, stopped 140085123085888)>
22
<Thread(example9, started 140085114693184)>
23
<Thread(example9, stopped 140085114693184)>