Skip to content

Commit 32c201e

Browse files
authored
🐛 Fix status process in tests (#361)
* Add build arg --dev to install dev dependencies * Properly handle the exit code from tests * Remove * at the end of COPY poetry.lock * Simplify list of deps and add poetry.lock * Remove unecessary echo
1 parent 2441091 commit 32c201e

File tree

5 files changed

+740
-58
lines changed

5 files changed

+740
-58
lines changed

dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This is a dev file for testing the changes to this repo
22
docker build . -t satel/python-base:latest
33
cd tests/
4-
docker build . -t docker-python-base
4+
docker build . --build-arg DEVFLAG=--dev -t docker-python-base
55

66
case $1 in
77
run)

test_suite.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ checkuser() {
1515

1616

1717
reportvalidation() {
18-
if [ -z "$1" ]
18+
if [ "$1" -eq 0 ]
1919
then
2020
echo "OK"
2121
else
2222
echo -e "\e[1m\e[91mFAILED\e[21m\e[39m"
23-
echo "$1"
23+
echo "$2"
2424
fi
2525
}
2626

@@ -39,15 +39,18 @@ python -m pytest -vv --durations=3 --cov ./ --cov-report term-missing $PYTEST_RE
3939

4040
echo -ne "$SECTION_PREFIX CHECK DOCKER USER IS PYTHON: "
4141
USEROUT=`checkuser`
42-
reportvalidation "$USEROUT"; STATUS2=$?
42+
STATUS2=$?
43+
reportvalidation "$STATUS2" "$USEROUT"
4344

4445
echo -ne "$SECTION_PREFIX CHECK TYPING: "
4546
MYPYOUT=`mypy --cache-dir /home/python --no-error-summary . $MYPY_REPORTS`
46-
reportvalidation "$MYPYOUT"; STATUS3=$?
47+
STATUS3=$?
48+
reportvalidation "$STATUS3" "$MYPYOUT"
4749

4850
echo -ne "$SECTION_PREFIX CHECK LINTING: "
4951
FLAKE8OUT=`flake8`
50-
reportvalidation "$FLAKE8OUT"; STATUS4=$?
52+
STATUS4=$?
53+
reportvalidation "$STATUS4" "$FLAKE8OUT"
5154

5255
echo -ne "$SECTION_PREFIX CHECK FORMATTING: "
5356
BLACKOUT=`black --skip-string-normalization --line-length 99 ./ --check 2>&1`; STATUS5=$?
@@ -59,11 +62,10 @@ else
5962
echo "$BLACKOUT"
6063
fi
6164

62-
echo
63-
6465
echo -ne "$SECTION_PREFIX CHECK DOCSTRINGS: "
6566
INTERROGATEOUT=`interrogate`
66-
reportvalidation "$INTERROGATEOUT"; STATUS5=$?
67+
STATUS5=$?
68+
reportvalidation "$STATUS5" "$INTERROGATEOUT"
6769

6870
if [[ $1 == "reports" ]]
6971
then
@@ -72,5 +74,5 @@ then
7274
echo
7375
fi
7476

75-
TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5 + STATUS6))
77+
TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5))
7678
exit $TOTAL

tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG IMAGE_VERSION=satel/python-base:latest
44
FROM python:3.10.5-slim AS requirements-stage
55

66
RUN pip install poetry
7-
COPY ./pyproject.toml ./poetry.lock* ./
7+
COPY ./pyproject.toml ./poetry.lock ./
88

99
# Generate the requirement file
1010
ARG DEVFLAG

0 commit comments

Comments
 (0)