@@ -36,12 +36,12 @@ function join { local IFS="$1"; shift; echo "$*"; }
3636PACK_TEST_PYTHON_DEPENDENCIES_NAMES=(
3737 ' pytest'
3838 ' mock'
39- ' coverage '
39+ ' pytest-cov '
4040)
4141PACK_TEST_PYTHON_DEPENDENCIES_VERSIONS=(
4242 ' >7'
4343 ' >=4.0.3'
44- ' >=4.4 .1'
44+ ' >=6.1 .1'
4545)
4646
4747VIRTUALENVS_DIR=" /tmp/st2-pack-tests-virtualenvs"
@@ -69,7 +69,7 @@ STACKSTORM_VIRTUALENV_PYTHON_BINARY="${STACKSTORM_VIRTUALENV_BIN}/python"
6969
7070function usage() {
7171 echo " Usage: $0 [-c] [-j] [-t] [-v] [-x] -p <path to pack> [-f <test file module / class / method>]" >&2
72- echo " -f : Run a specific test file or test class method (e.g. -f test_action_download: DownloadGitRepoActionTestCase. test_run_pack_download)" >&2
72+ echo " -f : Run a specific test file or test class method (e.g. -f test_action_download.py:: DownloadGitRepoActionTestCase:: test_run_pack_download)" >&2
7373 echo " -c : Run tests with code coverage reporting enabled" >&2
7474 echo " -j : Just run tests. Use previously installed dependencies" >&2
7575 echo " and virtualenv, if any, for subsequent test runs." >&2
@@ -270,7 +270,7 @@ elif [ "${ENABLE_COVERAGE}" = true ]; then
270270 for(( i = 0 ; i < ${# PACK_TEST_PYTHON_DEPENDENCIES_NAMES[@]} ; i++ )) ; do
271271 DEPENDENCY_NAME=" ${PACK_TEST_PYTHON_DEPENDENCIES_NAMES[$i]} "
272272
273- if [ " ${DEPENDENCY_NAME} " = " coverage " ]; then
273+ if [ " ${DEPENDENCY_NAME} " = " pytest-cov " ]; then
274274 DEPENDENCY_VERSION=" ${PACK_TEST_PYTHON_DEPENDENCIES_VERSIONS[$i]} "
275275
276276 echo ${INSTALLED_PIP_PACKAGES} | grep " ${DEPENDENCY_NAME} " > /dev/null || pip install --cache-dir ${HOME} /.pip-cache ${ST2_PIP_OPTIONS} " ${DEPENDENCY_NAME}${DEPENDENCY_VERSION} "
@@ -333,23 +333,15 @@ if [ "${ENABLE_COVERAGE}" = true ]; then
333333 done # end for each $PACK_PYTHON_DIR
334334fi # end enable test coverage
335335
336- PYTEST=(pytest)
337- if head -n 1 $( command -v pytest) | grep -q ' -sE$' ; then
338- # workaround pants+pex default of hermetic scripts so we can run pytest with PYTHONPATH
339- if [ -f " ${STACKSTORM_VIRTUALENV_PYTHON_BINARY} " ]; then
340- PYTEST=(${STACKSTORM_VIRTUALENV_PYTHON_BINARY} -m " pytest" )
341- else
342- PYTEST=(python3 -m " pytest" )
343- fi
344- fi
336+ PYTEST=(python3 -m pytest)
345337
346338# Change to the pack's directory (required for test coverage reporting)
347339pushd ${PACK_PATH} > /dev/null
348340
349341# Execute the tests
350342if [ " ${TEST_LOCATION} " ]; then
351343 # Run a specific test file, class or method
352- ${PYTEST[@]} ${PYTEST_OPTS[@]} ${TEST_LOCATION}
344+ ${PYTEST[@]} ${PYTEST_OPTS[@]} ${PACK_TESTS_PATH}${ TEST_LOCATION}
353345else
354346 # Run all tests inside the pack
355347 ${PYTEST[@]} ${PYTEST_OPTS[@]} ${PACK_TESTS_PATH}
0 commit comments