Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ If you intend for any variables/functions/classes to be available outside of the
#### Unit testing
MONAI tests are located under `tests/`.

- The unit test's file name follows `test_[module_name].py`.
- The unit test's file name currently follows `test_[module_name].py` or `test_[module_name]_dist.py`.
- The `test_[module_name]_dist.py` subset of unit tests requires a distributed environment to verify the module with distributed GPU-based computation.
- The integration test's file name follows `test_integration_[workflow_name].py`.

A bash script (`runtests.sh`) is provided to run all tests locally.
Expand Down
15 changes: 14 additions & 1 deletion runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ doClangFormat=false
doPytypeFormat=false
doMypyFormat=false
doCleanup=false
doDistTests=false

NUM_PARALLEL=1

PY_EXE=${MONAI_PY_EXE:-$(which python)}

function print_usage {
echo "runtests.sh [--codeformat] [--autofix] [--black] [--isort] [--flake8] [--clangformat] [--pytype] [--mypy]"
echo " [--unittests] [--coverage] [--quick] [--net] [--dryrun] [-j number] [--clean] [--help] [--version]"
echo " [--unittests] [--disttests] [--coverage] [--quick] [--net] [--dryrun] [-j number] [--clean] [--help] [--version]"
echo ""
echo "MONAI unit testing utilities."
echo ""
Expand All @@ -79,6 +80,7 @@ function print_usage {
echo ""
echo "MONAI unit testing options:"
echo " -u, --unittests : perform unit testing"
echo " --disttests : perform distributed unit testing"
echo " --coverage : report testing code coverage, to be used with \"--net\", \"--unittests\""
echo " -q, --quick : skip long running unit tests and integration tests"
echo " --net : perform integration testing"
Expand Down Expand Up @@ -232,6 +234,9 @@ do
doPytypeFormat=true
doMypyFormat=true
;;
--disttests)
doDistTests=true
;;
--black)
doBlackFormat=true
;;
Expand Down Expand Up @@ -519,6 +524,14 @@ then
${cmdPrefix}${cmd} ./tests/runner.py -p "test_((?!integration).)"
fi

# distributed test only
if [ $doDistTests = true ]
then
echo "${separator}${blue}run distributed unit test cases${noColor}"
torch_validate
${cmdPrefix}${cmd} ./tests/runner.py -p "test_.*_dist$"
fi

# network training/inference/eval integration tests
if [ $doNetTests = true ]
then
Expand Down