Skip to content

Commit

Permalink
Update run_*.sh scripts (#1443)
Browse files Browse the repository at this point in the history
The Maintainers Guide says that no formatter nor code analyzer
is 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
  * simplify handling of a test target
  • Loading branch information
Jamim authored Dec 6, 2023
1 parent 69638bf commit 56f7127
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 36 deletions.
24 changes: 9 additions & 15 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
# 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 != "" ]]
then
black slack_sdk/ slack/ tests/ && \
python setup.py codegen && \
python setup.py integration_tests --test-target $1
else
black slack_sdk/ slack/ tests/ && \
python setup.py codegen && \
python setup.py integration_tests
fi
test_target="${1:-integration_tests/}"
python setup.py integration_tests --test-target $test_target
24 changes: 9 additions & 15 deletions scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
# 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 != "" ]]
then
black slack_sdk/ slack/ tests/ && \
python setup.py codegen && \
python setup.py unit_tests --test-target $1
else
black slack_sdk/ slack/ tests/ && \
python setup.py codegen && \
python setup.py unit_tests
fi
test_target="${1:-tests/}"
python setup.py unit_tests --test-target $test_target
18 changes: 12 additions & 6 deletions scripts/run_validation.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 56f7127

Please sign in to comment.