-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_tests.sh
executable file
·53 lines (46 loc) · 1.17 KB
/
run_tests.sh
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
#!/bin/bash
# Add both the project root and tests directory to Python path
export PYTHONPATH="$(pwd):$(pwd)/Tests:$PYTHONPATH"
export PIPENV_VERBOSITY=-1
# Define coverage paths as arrays
INCLUDE_PATHS=(
"Alpha/Base.py"
"Alpha/Utils/*"
"Monitor/Base.py"
"Execution/Base.py"
"Execution/Utils/*"
"CustomIndicators/*"
"Data/*"
"Initialization/*"
"Order/*"
"PortfolioConstruction/*"
"Strategy/*"
"Tools/*"
)
OMIT_PATHS=(
"Tests/*"
"*/__init__.py"
"Alpha/[!B]*.py"
"Monitor/[!B]*.py"
"Execution/[!B]*.py"
)
# Join arrays with commas
INCLUDE_STRING=$(IFS=,; echo "${INCLUDE_PATHS[*]}")
OMIT_STRING=$(IFS=,; echo "${OMIT_PATHS[*]}")
# Run mamba tests
echo "Starting mamba tests..."
if [ "$CI" = "true" ]; then
pipenv run mamba Tests/specs --enable-coverage --format=junit > junit.xml
else
pipenv run mamba Tests/specs --enable-coverage
fi
# Generate coverage reports in HTML format
pipenv run coverage html \
--include="$INCLUDE_STRING" \
--omit="$OMIT_STRING"
# Generate XML coverage only in CI environment
if [ "$CI" = "true" ]; then
pipenv run coverage xml \
--include="$INCLUDE_STRING" \
--omit="$OMIT_STRING"
fi