-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·64 lines (55 loc) · 1.53 KB
/
test.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Parse flags: -r for release mode, -d to include directories starting
# with '__' when running payload tests. Export an env var consumed by
# the pytest loaders in `tests/`.
RELEASE_MODE=false
INCLUDE_DUNDERS=false
for arg in "$@"; do
case "$arg" in
-r)
RELEASE_MODE=true
;;
-d)
INCLUDE_DUNDERS=true
;;
esac
done
if [ "$INCLUDE_DUNDERS" = true ]; then
export CSV4J_INCLUDE_DUNDERS=1
fi
rm dump/*
#source venv/bin/activate
echo -e "\nStart black..."
echo "######################"
black src/**.py
echo -e "\nStart ruff..."
echo "######################"
ruff check src/**.py
echo -e "\nStart flake..."
echo "######################"
flake8 src/**.py
echo -e "\nStart bandit..."
echo "######################"
bandit src/**.py
echo -e "\nStart mypy..."
echo "######################"
mypy --install-types
mypy src/**.py
echo -e "\nStart pytest..."
echo "######################"
pytest ./tests/test_main.py ./tests/test_payload.py ./tests/test_specials.py ./tests/test_cli.py -v #--tb=no
if [ "$RELEASE_MODE" = true ]; then
# Release mode: build, create venv, install wheel, and test
python -m build --wheel
if [ -d ".whl_test_env" ]; then
rm -rf .whl_test_env
fi
python -m venv .whl_test_env
source .whl_test_env/bin/activate
pip install --quiet --upgrade pip
pip install --quiet -r requirements.txt
pip install --quiet dist/csv4j-*.whl pytest
pytest ./tests/test_whl.py -v --tb=short
deactivate
rm -rf .whl_test_env
fi