Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
GRAAL-Research
GitHub Repository: GRAAL-Research/deepparse
Path: blob/main/run_tests_python_envs.sh
865 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*****"
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
# All tests env print
98
echo "*****The results of the tests are:"
99
return_status=0
100
101
if [ $python3_8_tests_res -eq 1 ]; then
102
echo "Success for Python 3.8"
103
else
104
return_status=1
105
echo "Fail for Python 3.8"
106
fi
107
108
if [ $python3_9_tests_res -eq 1 ]; then
109
echo "Success for Python 3.9"
110
else
111
return_status=1
112
echo "Fail for Python 3.9"
113
fi
114
115
if [ $python3_10_tests_res -eq 1 ]; then
116
echo "Success for Python 3.10"
117
else
118
return_status=1
119
echo "Fail for Python 3.10"
120
fi
121
122
if [ $python3_11_tests_res -eq 1 ]; then
123
echo "Success for Python 3.11"
124
else
125
return_status=1
126
echo "Fail for Python 3.11"
127
fi
128
129
if [ $return_status -eq 1 ]; then
130
exit 1
131
else
132
exit 0
133
fi
134
135