Skip to content

Commit 623401a

Browse files
authored
Merge pull request #638 from asenyaev/asen/pylint_test
Added pylint test
2 parents 8880543 + ed16e8e commit 623401a

File tree

6 files changed

+54
-20
lines changed

6 files changed

+54
-20
lines changed

.github/workflows/build_wheels_linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
- name: Checkout
103103
uses: actions/checkout@v2
104104
with:
105-
submodules: false
105+
submodules: true
106106
fetch-depth: 0
107107

108108
- name: Setup Environment variables

.github/workflows/build_wheels_macos.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ jobs:
137137
CONFIG_PATH: travis_config.sh
138138
PLAT: x86_64
139139
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
140+
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
140141

141142
steps:
142143
- name: Checkout
@@ -171,6 +172,12 @@ jobs:
171172
cd ${{ github.workspace }}/opencv
172173
python modules/python/test/test.py -v --repo .
173174
175+
- name: Pylint test
176+
run: |
177+
python -m pip install pylint==2.12.2
178+
cd ${{ github.workspace }}/tests
179+
python -m pylint $PYLINT_TEST_FILE
180+
174181
test_release_opencv_python:
175182
if: github.event_name == 'release' && github.event.release.prerelease
176183
needs: [build, test]

.github/workflows/build_wheels_macos_m1.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181

8282
env:
8383
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
84+
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
8485

8586
steps:
8687
- name: Checkout
@@ -106,6 +107,12 @@ jobs:
106107
cd ${{ github.workspace }}/opencv
107108
arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
108109
110+
- name: Pylint test
111+
run: |
112+
arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2
113+
cd ${{ github.workspace }}/tests
114+
arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
115+
109116
test_release_opencv_python:
110117
if: github.event_name == 'release' && github.event.release.prerelease
111118
needs: [build, test]

.github/workflows/build_wheels_windows.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
env:
9797
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
9898
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
99+
PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
99100

100101
steps:
101102
- name: Checkout
@@ -130,6 +131,13 @@ jobs:
130131
python modules\python\test\test.py -v --repo .
131132
shell: cmd
132133

134+
- name: Pylint test
135+
run: |
136+
python -m pip install pylint==2.12.2
137+
cd ${{ github.workspace }}\tests
138+
python -m pylint $PYLINT_TEST_FILE
139+
shell: cmd
140+
133141
test_release_opencv_python:
134142
if: github.event_name == 'release' && github.event.release.prerelease
135143
needs: [build-windows-x86_64, test]

tests/pylintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Source: opencv/platforms/scripts/pylintrc
2+
3+
[MESSAGES CONTROL]
4+
5+
# Disable all to choose the Tests one by one
6+
disable=all
7+
8+
# Tests
9+
enable=bad-indentation, # Used when an unexpected number of indentation’s tabulations or spaces has been found.
10+
mixed-indentation, # Used when there are some mixed tabs and spaces in a module.
11+
unnecessary-semicolon, # Used when a statement is ended by a semi-colon (”;”), which isn’t necessary.
12+
unused-variable # Used when a variable is defined but not used. (Use _var to ignore var).

travis_config.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,37 +141,37 @@ function run_tests {
141141

142142
PYTHON=python$PYTHON_VERSION
143143

144-
if [ -n "$IS_OSX" ]; then
145-
echo "Running for OS X"
146-
147-
cd ../tests
148-
$PYTHON get_build_info.py
149-
150-
cd ../opencv/
151-
export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata
152-
else
153-
echo "Running for linux"
154-
155-
if [ $PYTHON == "python3.6" ]; then
156-
$PYTHON -m pip install -U numpy==1.19.4
157-
fi
158-
cd /io/tests
159-
$PYTHON get_build_info.py
144+
echo "Running for linux"
160145

161-
cd /io/opencv
162-
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
146+
if [ $PYTHON == "python3.6" ]; then
147+
$PYTHON -m pip install -U numpy==1.19.4
163148
fi
149+
cd /io/tests
150+
$PYTHON get_build_info.py
151+
152+
cd /io/opencv
153+
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
164154

165155
test_wheels
156+
pylint_test
166157
}
167158

168159
function test_wheels {
169160

170-
echo "Starting tests..."
161+
echo "Starting OpenCV tests..."
171162

172163
#Test package
173164
$PYTHON modules/python/test/test.py -v --repo .
174165
}
175166

167+
function pylint_test {
168+
169+
echo "Starting Pylint tests..."
170+
171+
$PYTHON -m pip install pylint==2.12.2
172+
cd /io/tests
173+
$PYTHON -m pylint /io/opencv/samples/python/squares.py
174+
}
175+
176176
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
177177
set -x

0 commit comments

Comments
 (0)