From 1f92cbeb01f45766acb79a111e14aff9160940d5 Mon Sep 17 00:00:00 2001 From: Aliaksei Urbanski Date: Thu, 7 Dec 2023 00:31:08 +0300 Subject: [PATCH] Update run_*.sh scripts The Maintainers Guide says that no formatter nor code analyzer will be involved when you run unit tests, so I suppose black was added by mistake and should be removed. Also, using set -e allows you to avoid chaining of commands. These changes: * remove black from run_*_tests.sh scripts * add set -e to unchain commands in scripts --- scripts/run_integration_tests.sh | 21 ++++++++++----------- scripts/run_unit_tests.sh | 21 ++++++++++----------- scripts/run_validation.sh | 18 ++++++++++++------ 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index c67a4a08..07553fc2 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -3,22 +3,21 @@ # all: ./scripts/run_integration_tests.sh # single: ./scripts/run_integration_tests.sh integration_tests/web/test_async_web_client.py +set -e + script_dir=`dirname $0` cd ${script_dir}/.. test_target="$1" -python_version=`python --version | awk '{print $2}'` -pip install -U pip && \ - pip install -r requirements/testing.txt && \ - pip install -r requirements/optional.txt && \ +pip install -U pip +pip install -r requirements/testing.txt \ + -r requirements/optional.txt + +python setup.py codegen -if [[ $test_target != "" ]] +if [ -n "$test_target" ] then - black slack_sdk/ slack/ tests/ && \ - python setup.py codegen && \ - python setup.py integration_tests --test-target $1 + python setup.py integration_tests --test-target $test_target else - black slack_sdk/ slack/ tests/ && \ - python setup.py codegen && \ - python setup.py integration_tests + python setup.py integration_tests fi diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index b9090c01..5b924db3 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -3,22 +3,21 @@ # all: ./scripts/run_unit_tests.sh # single: ./scripts/run_unit_tests.sh tests/slack_sdk_async/web/test_web_client_coverage.py +set -e + script_dir=`dirname $0` cd ${script_dir}/.. test_target="$1" -python_version=`python --version | awk '{print $2}'` -pip install -U pip && \ - pip install -r requirements/testing.txt && \ - pip install -r requirements/optional.txt && \ +pip install -U pip +pip install -r requirements/testing.txt \ + -r requirements/optional.txt + +python setup.py codegen -if [[ $test_target != "" ]] +if [ -n "$test_target" ] then - black slack_sdk/ slack/ tests/ && \ - python setup.py codegen && \ - python setup.py unit_tests --test-target $1 + python setup.py unit_tests --test-target $test_target else - black slack_sdk/ slack/ tests/ && \ - python setup.py codegen && \ - python setup.py unit_tests + python setup.py unit_tests fi diff --git a/scripts/run_validation.sh b/scripts/run_validation.sh index cca0dd8e..b09e3f09 100755 --- a/scripts/run_validation.sh +++ b/scripts/run_validation.sh @@ -1,11 +1,17 @@ #!/bin/bash # ./scripts/run_validation.sh +set -e + script_dir=`dirname $0` cd ${script_dir}/.. -pip install -U pip && \ - pip install -r requirements/testing.txt && \ - pip install -r requirements/optional.txt && \ - black slack_sdk/ slack/ tests/ integration_tests/ && \ - python setup.py codegen && \ - python setup.py validate +pip install -U pip +pip install -r requirements/testing.txt \ + -r requirements/optional.txt + +black --check tests/ integration_tests/ +# TODO: resolve linting errors for tests +# flake8 tests/ integration_tests/ + +python setup.py codegen +python setup.py validate