Skip to content

Commit 8d6100c

Browse files
committed
CI fix codecov uploads
1 parent b4aeb63 commit 8d6100c

2 files changed

Lines changed: 30 additions & 24 deletions

File tree

continuous_integration/upload_codecov.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
set -e
44

5-
python -m pip --user install codecov
5+
python -m pip install --user codecov
66

77
python -m codecov || echo "codecov upload failed"

threadpoolctl/tests/test_threadpool_limits.py

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ def test_threadpool_limits(openblas_present, mkl_present, prefix):
3434
else:
3535
pytest.skip("Need {} support".format(prefix))
3636

37-
new_limits = _set_threadpool_limits(limits={prefix: 1})
38-
new_limits = {clib['prefix']: clib['n_thread'] for clib in new_limits}
39-
assert new_limits[prefix] == 1
40-
41-
threadpool_limits(limits={prefix: 3})
42-
new_limits = get_threadpool_limits()
43-
new_limits = {clib['prefix']: clib['n_thread'] for clib in new_limits}
44-
assert new_limits[prefix] in (3, old_limits[prefix])
37+
try:
38+
new_limits = _set_threadpool_limits(limits={prefix: 1})
39+
new_limits = {clib['prefix']: clib['n_thread'] for clib in new_limits}
40+
assert new_limits[prefix] == 1
41+
42+
threadpool_limits(limits={prefix: 3})
43+
new_limits = get_threadpool_limits()
44+
new_limits = {clib['prefix']: clib['n_thread'] for clib in new_limits}
45+
assert new_limits[prefix] in (3, old_limits[prefix])
46+
finally:
47+
# Avoid having side effects in case of failures
48+
threadpool_limits(limits=old_limits)
4549

46-
threadpool_limits(limits=old_limits)
4750
new_limits = get_threadpool_limits()
4851
new_limits = {clib['prefix']: clib['n_thread'] for clib in new_limits}
4952
assert new_limits[prefix] == old_limits[prefix]
@@ -62,22 +65,25 @@ def test_set_threadpool_limits_apis(user_api):
6265
old_limits = get_threadpool_limits()
6366
old_limits = {clib['prefix']: clib['n_thread'] for clib in old_limits}
6467

65-
new_limits = _set_threadpool_limits(limits=1, user_api=user_api)
66-
for module in new_limits:
67-
if should_skip_module(module):
68-
continue
69-
if module['user_api'] in api_modules:
70-
assert module['n_thread'] == 1
68+
try:
69+
new_limits = _set_threadpool_limits(limits=1, user_api=user_api)
70+
for module in new_limits:
71+
if should_skip_module(module):
72+
continue
73+
if module['user_api'] in api_modules:
74+
assert module['n_thread'] == 1
7175

72-
threadpool_limits(limits=3, user_api=user_api)
73-
new_limits = get_threadpool_limits()
74-
for module in new_limits:
75-
if should_skip_module(module):
76-
continue
77-
if module['user_api'] in api_modules:
78-
assert module['n_thread'] in (3, old_limits[module['prefix']])
76+
threadpool_limits(limits=3, user_api=user_api)
77+
new_limits = get_threadpool_limits()
78+
for module in new_limits:
79+
if should_skip_module(module):
80+
continue
81+
if module['user_api'] in api_modules:
82+
assert module['n_thread'] in (3, old_limits[module['prefix']])
83+
finally:
84+
# Avoid having side effects on other tests in case of failure
85+
threadpool_limits(limits=old_limits)
7986

80-
threadpool_limits(limits=old_limits)
8187
new_limits = get_threadpool_limits()
8288
for module in new_limits:
8389
assert module['n_thread'] == old_limits[module['prefix']]

0 commit comments

Comments
 (0)