Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
5c5e459b
Commit
5c5e459b
authored
May 17, 2022
by
VVsssssk
Committed by
ChaimZhu
Jul 20, 2022
Browse files
[CI] Force py files being added/modified to meet our UT and docstr coverage requirements
parent
1aa10524
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
.dev_scripts/covignore.cfg
.dev_scripts/covignore.cfg
+6
-0
.dev_scripts/diff_coverage_test.sh
.dev_scripts/diff_coverage_test.sh
+42
-0
No files found.
.dev_scripts/covignore.cfg
0 → 100644
View file @
5c5e459b
# Each line should be the relative path to the root directory
# of this repo. Support regular expression as well.
# For example:
# .*/utils.py
.*/__init__.py
.dev_scripts/diff_coverage_test.sh
0 → 100755
View file @
5c5e459b
#!/bin/bash
readarray
-t
IGNORED_FILES <
$(
dirname
"
$0
"
)
/covignore.cfg
REUSE_COVERAGE_REPORT
=
${
REUSE_COVERAGE_REPORT
:-
0
}
REPO
=
${
1
:-
"origin"
}
BRANCH
=
${
2
:-
"refactor_dev"
}
git fetch
$REPO
$BRANCH
PY_FILES
=
""
for
FILE_NAME
in
$(
git diff
--name-only
${
REPO
}
/
${
BRANCH
}
)
;
do
# Only test python files in mmdet3d/ existing in current branch, and not ignored in covignore.cfg
if
[
${
FILE_NAME
:
-3
}
==
".py"
]
&&
[
${
FILE_NAME
:0:8
}
==
"mmdet3d/"
]
&&
[
-f
"
$FILE_NAME
"
]
;
then
IGNORED
=
false
for
IGNORED_FILE_NAME
in
"
${
IGNORED_FILES
[@]
}
"
;
do
# Skip blank lines
if
[
-z
"
$IGNORED_FILE_NAME
"
]
;
then
continue
fi
if
[
"
${
IGNORED_FILE_NAME
::1
}
"
!=
"#"
]
&&
[[
"
$FILE_NAME
"
=
~
$IGNORED_FILE_NAME
]]
;
then
echo
"Ignoring
$FILE_NAME
"
IGNORED
=
true
break
fi
done
if
[
"
$IGNORED
"
=
false
]
;
then
PY_FILES
=
"
$PY_FILES
$FILE_NAME
"
fi
fi
done
# Only test the coverage when PY_FILES are not empty, otherwise they will test the entire project
if
[
!
-z
"
${
PY_FILES
}
"
]
then
if
[
"
$REUSE_COVERAGE_REPORT
"
==
"0"
]
;
then
coverage run
--branch
--source
mmocr
-m
pytest tests/
fi
coverage report
--fail-under
80
-m
$PY_FILES
interrogate
-v
--ignore-init-method
--ignore-module
--ignore-nested-functions
--ignore-magic
--ignore-regex
"__repr__"
--fail-under
95
$PY_FILES
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment