Skip to content

Commit f93b8a2

Browse files
committed
Merge remote-tracking branch 'upstream/maint/3.2.x'
2 parents 62aea04 + 06a60fd commit f93b8a2

File tree

5 files changed

+33
-15
lines changed

5 files changed

+33
-15
lines changed

.github/workflows/misc.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ jobs:
5151
- name: Run tests
5252
run: tools/ci/check.sh
5353
if: ${{ matrix.check != 'skiptests' }}
54-
- uses: codecov/codecov-action@v1
55-
with:
56-
file: for_testing/coverage.xml
54+
- name: Submit coverage
55+
run: tools/ci/submit_coverage.sh
5756
if: ${{ always() }}
5857
- name: Upload pytest test results
5958
uses: actions/upload-artifact@v2

.github/workflows/pre-release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ jobs:
7474
- name: Run tests
7575
run: tools/ci/check.sh
7676
if: ${{ matrix.check != 'skiptests' }}
77-
- uses: codecov/codecov-action@v1
78-
with:
79-
file: for_testing/coverage.xml
77+
- name: Submit coverage
78+
run: tools/ci/submit_coverage.sh
8079
if: ${{ always() }}
8180
- name: Upload pytest test results
8281
uses: actions/upload-artifact@v2

.github/workflows/stable.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ jobs:
117117
- name: Run tests
118118
run: tools/ci/check.sh
119119
if: ${{ matrix.check != 'skiptests' }}
120-
- uses: codecov/codecov-action@v1
121-
with:
122-
file: for_testing/coverage.xml
120+
- name: Submit coverage
121+
run: tools/ci/submit_coverage.sh
123122
if: ${{ always() }}
124123
- name: Upload pytest test results
125124
uses: actions/upload-artifact@v2

nibabel/tests/test_optpkg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def test_basic():
3939
# We never have package _not_a_package
4040
assert_bad('_not_a_package')
4141

42-
# setup_module imports unittest, so make sure we don't disrupt that
42+
# Only disrupt imports for "nottriedbefore" package
4343
orig_import = builtins.__import__
4444
def raise_Exception(*args, **kwargs):
45-
if args[0] == 'unittest':
46-
return orig_import(*args, **kwargs)
47-
raise Exception(
48-
"non ImportError could be thrown by some malfunctioning module "
49-
"upon import, and optional_package should catch it too")
45+
if args[0] == 'nottriedbefore':
46+
raise Exception(
47+
"non ImportError could be thrown by some malfunctioning module "
48+
"upon import, and optional_package should catch it too")
49+
return orig_import(*args, **kwargs)
5050
with mock.patch.object(builtins, '__import__', side_effect=raise_Exception):
5151
assert_bad('nottriedbefore')
5252

tools/ci/submit_coverage.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
echo Submitting coverage
4+
5+
source tools/ci/activate.sh
6+
7+
set -eu
8+
9+
set -x
10+
11+
COVERAGE_FILE="for_testing/coverage.xml"
12+
13+
if [ -e "$COVERAGE_FILE" ]; then
14+
# Pin codecov version to reduce scope for malicious updates
15+
python -m pip install "codecov==2.1.11"
16+
python -m codecov --file for_testing/coverage.xml
17+
fi
18+
19+
set +eux
20+
21+
echo Done submitting coverage

0 commit comments

Comments
 (0)