-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathrun_tests_python_envs.sh
More file actions
executable file
·133 lines (101 loc) · 3.58 KB
/
run_tests_python_envs.sh
File metadata and controls
executable file
·133 lines (101 loc) · 3.58 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
# To run using ZSH: zsh -i ./codecov_push.sh
# To run using bash: bash -i ./codecov_push.sh
# We test on Deepparse supported Python versions, namely, 3.10, 3.11, 3.12 and 3.13
echo "*****Starting of testing Deepparse on Python version 3.10, 3.11, 3.12 and 3.13*****"
# We export the reports into a directory. But to do so, we need to move into that directory
# and run pytest from there
mkdir -p export_html_reports
cd ./export_html_reports
# Create a new Python env 3.10
conda create --name deepparse_pytest_3_10 python=3.10 -y --force
conda activate deepparse_pytest_3_10
# Install dependencies
pip install -e '..[all]'
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.10*****"
conda run -n deepparse_pytest_3_10 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_10 --cov-report xml:export_xml_report_3_10.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_10_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_10
# Create a new Python env 3.11
conda create --name deepparse_pytest_3_11 python=3.11 -y --force
conda activate deepparse_pytest_3_11
# Install dependencies
pip install -e '..[all]'
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.11*****"
conda run -n deepparse_pytest_3_11 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_11 --cov-report xml:export_xml_report_3_11.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_11_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_11
# Create a new Python env 3.12
conda create --name deepparse_pytest_3_12 python=3.12 -y --force
conda activate deepparse_pytest_3_12
# Install dependencies
pip install -e '..[all]'
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.12*****"
conda run -n deepparse_pytest_3_12 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_12 --cov-report xml:export_xml_report_3_12.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_12_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_12
# Create a new Python env 3.13
conda create --name deepparse_pytest_3_13 python=3.13 -y --force
conda activate deepparse_pytest_3_13
# Install dependencies
pip install -e '..[all]'
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.13*****"
conda run -n deepparse_pytest_3_13 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_13 --cov-report xml:export_xml_report_3_13.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_13_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_13
# All tests env print
echo "*****The results of the tests are:"
return_status=0
if [ $python3_10_tests_res -eq 1 ]; then
echo "Success for Python 3.10"
else
return_status=1
echo "Fail for Python 3.10"
fi
if [ $python3_11_tests_res -eq 1 ]; then
echo "Success for Python 3.11"
else
return_status=1
echo "Fail for Python 3.11"
fi
if [ $python3_12_tests_res -eq 1 ]; then
echo "Success for Python 3.12"
else
return_status=1
echo "Fail for Python 3.12"
fi
if [ $python3_13_tests_res -eq 1 ]; then
echo "Success for Python 3.13"
else
return_status=1
echo "Fail for Python 3.13"
fi
if [ $return_status -eq 1 ]; then
exit 1
else
exit 0
fi