From 1b5ee7d13e223e1e0c2212c5dee4bef16bbf0d2d Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Thu, 8 Nov 2018 07:00:29 +0700 Subject: [PATCH] .travis.yml: Invoke pytest directly Removes tests.sh wrapper and env_variables.sh Add coverage plugins to provide environment variables. --- .ci/env_variables.sh | 9 --------- .ci/tests.sh | 12 ------------ .travis.yml | 2 +- setup.cfg | 24 ++++++++++++++++++++++++ 4 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 .ci/env_variables.sh delete mode 100644 .ci/tests.sh diff --git a/.ci/env_variables.sh b/.ci/env_variables.sh deleted file mode 100644 index 2e859ab4c4..0000000000 --- a/.ci/env_variables.sh +++ /dev/null @@ -1,9 +0,0 @@ -export python_virtualenv=$(pyenv prefix) -export python_implementation=$(python -c "import platform; print(platform.python_implementation())") -export python_version=$(python -c "import sys; print(str(sys.version_info.major)+'.'+str(sys.version_info.minor))") - -if [ "$(uname)" == "Darwin" ]; then - export system_os="OSX" -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then - export system_os="LINUX" -fi diff --git a/.ci/tests.sh b/.ci/tests.sh deleted file mode 100644 index fe099b0c28..0000000000 --- a/.ci/tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -set -e -set -x - -source .ci/env_variables.sh - -args=() - -if [ "$system_os" == "LINUX" ]; then - args+=('--cov' '--cov-fail-under=100' '--doctest-modules') -fi - -python3 -m pytest "${args[@]}" diff --git a/.travis.yml b/.travis.yml index 536f2d8ff2..eef6c81c5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -188,7 +188,7 @@ before_script: script: - python setup.py bdist_wheel - pip install $(ls ./dist/*.whl)"[alldeps]" - - bash .ci/tests.sh + - pytest # Ensure bear requirements are in sync with the bear PipRequirement - .ci/generate_bear_requirements.py --check --update - git diff --exit-code diff --git a/setup.cfg b/setup.cfg index 2153cc4a01..404a76eb46 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,11 +24,35 @@ env = # PYTHONHASHSEED=0 is required to use same hashes in pytests-xdist's workers python_paths = .ci/ +[coverage:coverage_env_plugin] +markers = True + [coverage:run] branch = True cover_pylib = False + +plugins = + coverage_env_plugin + coverage_config_reload_plugin + source = bears +omit = + tests/* + setup.py + .ci/* + tests/python/bandit_test_files/ + [coverage:report] +fail_under = 100 show_missing = True +skip_covered = False +sort = Miss +exclude_lines = + pragma: no ?cover + pragma ${PLATFORM_SYSTEM}: no cover + pragma ${OS_NAME}: no cover + pragma Python [0-9.,]*${PYTHON_VERSION}[0-9.,]*: no cover + +[coverage:force_end_of_section]