forked from GRAAL-Research/deepparse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests_python_envs.sh
executable file
·135 lines (103 loc) · 3.56 KB
/
run_tests_python_envs.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
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
134
135
#!/bin/sh
# We test on Deepparse supported Python versions, namely, 3.7, 3.8, 3.9 and 3.10
echo "*****Starting of testing Deepparse on Python version 3.7, 3.8, 3.9, 3.10*****"
# 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.7
conda create --name deepparse_pytest_3_7 python=3.7 -y --force
conda activate deepparse_pytest_3_7
# Install dependencies
pip install -Ur ../tests/requirements.txt
pip install -Ur ../requirements.txt
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.7*****"
conda run -n deepparse_pytest_3_7 --live-stream pytest --cov ../deepparse --cov-report html:html_report_3_7 --cov-report xml:export_xml_report_3_7.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_7_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_7
# Create a new Python env 3.8
conda create --name deepparse_pytest_3_8 python=3.8 -y --force
conda activate deepparse_pytest_3_8
# Install dependencies
pip install -Ur ../tests/requirements.txt
pip install -Ur ../requirements.txt
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.8*****"
conda run -n deepparse_pytest_3_8 --live-stream pytest --cov ../deepparse --cov-report html:html_report_3_8 --cov-report xml:export_xml_report_3_8.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_8_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_8
# Create a new Python env 3.9
conda create --name deepparse_pytest_3_9 python=3.9 -y --force
conda activate deepparse_pytest_3_9
# Install dependencies
pip install -Ur ../tests/requirements.txt
pip install -Ur ../requirements.txt
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.9*****"
conda run -n deepparse_pytest_3_9 --live-stream pytest --cov ../deepparse --cov-report html:html_report_3_9 --cov-report xml:export_xml_report_3_9.xml --cov-config=.coveragerc ../tests
if [ $? -eq 0 ]; then
python3_9_tests_res=1
fi
# close conda env
conda deactivate
# Cleanup the conda env
conda env remove -n deepparse_pytest_3_9
# 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 -Ur ../tests/requirements.txt
pip install -Ur ../requirements.txt
# Run pytest from conda env
echo "*****Running test in Conda Python version 3.10*****"
conda run -n deepparse_pytest_3_10 --live-stream pytest --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
# All tests env print
echo "*****The results of the tests are:"
return_status=0
if [ $python3_7_tests_res -eq 1 ]; then
echo "Success for Python 3.7"
else
return_status=1
echo "Fail for Python 3.7"
fi
if [ $python3_8_tests_res -eq 1 ]; then
echo "Success for Python 3.8"
else
return_status=1
echo "Fail for Python 3.8"
fi
if [ $python3_9_tests_res -eq 1 ]; then
echo "Success for Python 3.9"
else
return_status=1
echo "Fail for Python 3.9"
fi
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 [ $return_status -eq 1]; then
exit 1
else
exit 0
fi