Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
GRAAL-Research
GitHub Repository: GRAAL-Research/deepparse
Path: blob/main/run_tests_python_envs.sh
1231 views
1
#!/bin/sh
2
# To run using ZSH: zsh -i ./codecov_push.sh
3
# To run using bash: bash -i ./codecov_push.sh
4
5
# We test on Deepparse supported Python versions, namely, 3.8, 3.9, 3.10 and 3.11
6
echo "*****Starting of testing Deepparse on Python version 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14*****"
7
8
# We export the reports into a directory. But to do so, we need to move into that directory
9
# and run pytest from there
10
mkdir -p export_html_reports
11
cd ./export_html_reports
12
13
# Create a new Python env 3.8
14
conda create --name deepparse_pytest_3_8 python=3.8 -y --force
15
conda activate deepparse_pytest_3_8
16
17
# Install dependencies
18
pip install -e '..[all]'
19
20
# Run pytest from conda env
21
echo "*****Running test in Conda Python version 3.8*****"
22
conda run -n deepparse_pytest_3_8 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_8 --cov-report xml:export_xml_report_3_8.xml --cov-config=.coveragerc ../tests
23
24
if [ $? -eq 0 ]; then
25
python3_8_tests_res=1
26
fi
27
28
# close conda env
29
conda deactivate
30
31
# Cleanup the conda env
32
conda env remove -n deepparse_pytest_3_8
33
34
# Create a new Python env 3.9
35
conda create --name deepparse_pytest_3_9 python=3.9 -y --force
36
conda activate deepparse_pytest_3_9
37
38
# Install dependencies
39
pip install -e '..[all]'
40
41
# Run pytest from conda env
42
echo "*****Running test in Conda Python version 3.9*****"
43
conda run -n deepparse_pytest_3_9 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_9 --cov-report xml:export_xml_report_3_9.xml --cov-config=.coveragerc ../tests
44
45
if [ $? -eq 0 ]; then
46
python3_9_tests_res=1
47
fi
48
49
# close conda env
50
conda deactivate
51
52
# Cleanup the conda env
53
conda env remove -n deepparse_pytest_3_9
54
55
# Create a new Python env 3.10
56
conda create --name deepparse_pytest_3_10 python=3.10 -y --force
57
conda activate deepparse_pytest_3_10
58
59
# Install dependencies
60
pip install -e '..[all]'
61
62
# Run pytest from conda env
63
echo "*****Running test in Conda Python version 3.10*****"
64
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
65
66
if [ $? -eq 0 ]; then
67
python3_10_tests_res=1
68
fi
69
70
# close conda env
71
conda deactivate
72
73
# Cleanup the conda env
74
conda env remove -n deepparse_pytest_3_11
75
76
# Create a new Python env 3.11
77
conda create --name deepparse_pytest_3_11 python=3.11 -y --force
78
conda activate deepparse_pytest_3_11
79
80
# Install dependencies
81
pip install -e '..[all]'
82
83
# Run pytest from conda env
84
echo "*****Running test in Conda Python version 3.11*****"
85
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
86
87
if [ $? -eq 0 ]; then
88
python3_11_tests_res=1
89
fi
90
91
# close conda env
92
conda deactivate
93
94
# Cleanup the conda env
95
conda env remove -n deepparse_pytest_3_11
96
97
# Create a new Python env 3.12
98
conda create --name deepparse_pytest_3_12 python=3.12 -y --force
99
conda activate deepparse_pytest_3_12
100
101
# Install dependencies
102
pip install -e '..[all]'
103
104
# Run pytest from conda env
105
echo "*****Running test in Conda Python version 3.12*****"
106
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
107
108
if [ $? -eq 0 ]; then
109
python3_12_tests_res=1
110
fi
111
112
# close conda env
113
conda deactivate
114
115
# Cleanup the conda env
116
conda env remove -n deepparse_pytest_3_12
117
118
# Create a new Python env 3.13
119
conda create --name deepparse_pytest_3_13 python=3.13 -y --force
120
conda activate deepparse_pytest_3_13
121
122
# Install dependencies
123
pip install -e '..[all]'
124
125
# Run pytest from conda env
126
echo "*****Running test in Conda Python version 3.13*****"
127
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
128
129
if [ $? -eq 0 ]; then
130
python3_13_tests_res=1
131
fi
132
133
# close conda env
134
conda deactivate
135
136
# Cleanup the conda env
137
conda env remove -n deepparse_pytest_3_13
138
139
# Create a new Python env 3.14
140
conda create --name deepparse_pytest_3_14 python=3.14 -y --force
141
conda activate deepparse_pytest_3_14
142
143
# Install dependencies
144
pip install -e '..[all]'
145
146
# Run pytest from conda env
147
echo "*****Running test in Conda Python version 3.14*****"
148
conda run -n deepparse_pytest_3_14 --live-stream pytest -o env="TEST_LEVEL=all" --cov ../deepparse --cov-report html:html_report_3_14 --cov-report xml:export_xml_report_3_14.xml --cov-config=.coveragerc ../tests
149
150
if [ $? -eq 0 ]; then
151
python3_14_tests_res=1
152
fi
153
154
# close conda env
155
conda deactivate
156
157
# Cleanup the conda env
158
conda env remove -n deepparse_pytest_3_14
159
160
161
# All tests env print
162
echo "*****The results of the tests are:"
163
return_status=0
164
165
if [ $python3_8_tests_res -eq 1 ]; then
166
echo "Success for Python 3.8"
167
else
168
return_status=1
169
echo "Fail for Python 3.8"
170
fi
171
172
if [ $python3_9_tests_res -eq 1 ]; then
173
echo "Success for Python 3.9"
174
else
175
return_status=1
176
echo "Fail for Python 3.9"
177
fi
178
179
if [ $python3_10_tests_res -eq 1 ]; then
180
echo "Success for Python 3.10"
181
else
182
return_status=1
183
echo "Fail for Python 3.10"
184
fi
185
186
if [ $python3_11_tests_res -eq 1 ]; then
187
echo "Success for Python 3.11"
188
else
189
return_status=1
190
echo "Fail for Python 3.11"
191
fi
192
193
if [ $python3_12_tests_res -eq 1 ]; then
194
echo "Success for Python 3.12"
195
else
196
return_status=1
197
echo "Fail for Python 3.12"
198
fi
199
200
if [ $python3_13_tests_res -eq 1 ]; then
201
echo "Success for Python 3.13"
202
else
203
return_status=1
204
echo "Fail for Python 3.13"
205
fi
206
207
if [ $python3_14_tests_res -eq 1 ]; then
208
echo "Success for Python 3.14"
209
else
210
return_status=1
211
echo "Fail for Python 3.14"
212
fi
213
214
if [ $return_status -eq 1 ]; then
215
exit 1
216
else
217
exit 0
218
fi
219
220