Skip to content

Commit

Permalink
better manual control over linting and testing (#2338)
Browse files Browse the repository at this point in the history
* better manual control over linting and testing

* hide set -x behind VERBOSE
  • Loading branch information
joaquincasares committed Jan 20, 2022
1 parent 3b1b928 commit 13bf1d5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
20 changes: 15 additions & 5 deletions discovery-provider/scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
set -e
#!/usr/bin/env bash

if [ -n "${FIX_LINT}" ]; then
ISORT_FLAG=
BLACK_FLAG=
else
ISORT_FLAG='--check-only'
BLACK_FLAG='--check'
fi

set -ex

cd $PROTOCOL_DIR
flake8 discovery-provider/src/
flake8 discovery-provider/integration_tests/
isort --check-only discovery-provider/src/
isort --check-only discovery-provider/integration_tests/
black --check discovery-provider/src/
black --check discovery-provider/integration_tests/
isort ${ISORT_FLAG} discovery-provider/src/
isort ${ISORT_FLAG} discovery-provider/integration_tests/
black ${BLACK_FLAG} discovery-provider/src/
black ${BLACK_FLAG} discovery-provider/integration_tests/
mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers discovery-provider/src/
13 changes: 9 additions & 4 deletions discovery-provider/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set -e
pip3 install -r requirements.txt
sleep 5
set +e
if [ -n "${VERBOSE}" ]; then
set -x
fi

# Reset local blockchain for deterministic test results
cd_contracts_repo
Expand Down Expand Up @@ -66,8 +69,10 @@ docker-compose \

sleep 5

# Unit tests
pytest src
if [ -z ${SKIP_TESTS+x} ]; then
# Unit tests
pytest src

# Integration tests
pytest integration_tests
# Integration tests
pytest integration_tests
fi
2 changes: 2 additions & 0 deletions service-commands/scripts/provision-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function setup_postgres() {
function setup_python() {
sudo add-apt-repository ppa:deadsnakes/ppa # python3.9 installation
sudo apt install -y "python$PYTHON_VERSION"
sudo apt install -y "python$PYTHON_VERSION-dev"
pip install wheel
pip install pre-commit==2.16.0
}

function setup_docker() {
Expand Down

0 comments on commit 13bf1d5

Please sign in to comment.