未验证 提交 623401a5 编写于 作者: A Andrey Senyaev 提交者: GitHub

Merge pull request #638 from asenyaev/asen/pylint_test

Added pylint test
...@@ -102,7 +102,7 @@ jobs: ...@@ -102,7 +102,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: false submodules: true
fetch-depth: 0 fetch-depth: 0
- name: Setup Environment variables - name: Setup Environment variables
......
...@@ -137,6 +137,7 @@ jobs: ...@@ -137,6 +137,7 @@ jobs:
CONFIG_PATH: travis_config.sh CONFIG_PATH: travis_config.sh
PLAT: x86_64 PLAT: x86_64
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
steps: steps:
- name: Checkout - name: Checkout
...@@ -171,6 +172,12 @@ jobs: ...@@ -171,6 +172,12 @@ jobs:
cd ${{ github.workspace }}/opencv cd ${{ github.workspace }}/opencv
python modules/python/test/test.py -v --repo . python modules/python/test/test.py -v --repo .
- name: Pylint test
run: |
python -m pip install pylint==2.12.2
cd ${{ github.workspace }}/tests
python -m pylint $PYLINT_TEST_FILE
test_release_opencv_python: test_release_opencv_python:
if: github.event_name == 'release' && github.event.release.prerelease if: github.event_name == 'release' && github.event.release.prerelease
needs: [build, test] needs: [build, test]
......
...@@ -81,6 +81,7 @@ jobs: ...@@ -81,6 +81,7 @@ jobs:
env: env:
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
steps: steps:
- name: Checkout - name: Checkout
...@@ -106,6 +107,12 @@ jobs: ...@@ -106,6 +107,12 @@ jobs:
cd ${{ github.workspace }}/opencv cd ${{ github.workspace }}/opencv
arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
- name: Pylint test
run: |
arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2
cd ${{ github.workspace }}/tests
arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
test_release_opencv_python: test_release_opencv_python:
if: github.event_name == 'release' && github.event.release.prerelease if: github.event_name == 'release' && github.event.release.prerelease
needs: [build, test] needs: [build, test]
......
...@@ -96,6 +96,7 @@ jobs: ...@@ -96,6 +96,7 @@ jobs:
env: env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true ACTIONS_ALLOW_UNSECURE_COMMANDS: true
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
steps: steps:
- name: Checkout - name: Checkout
...@@ -130,6 +131,13 @@ jobs: ...@@ -130,6 +131,13 @@ jobs:
python modules\python\test\test.py -v --repo . python modules\python\test\test.py -v --repo .
shell: cmd shell: cmd
- name: Pylint test
run: |
python -m pip install pylint==2.12.2
cd ${{ github.workspace }}\tests
python -m pylint $PYLINT_TEST_FILE
shell: cmd
test_release_opencv_python: test_release_opencv_python:
if: github.event_name == 'release' && github.event.release.prerelease if: github.event_name == 'release' && github.event.release.prerelease
needs: [build-windows-x86_64, test] needs: [build-windows-x86_64, test]
......
# Source: opencv/platforms/scripts/pylintrc
[MESSAGES CONTROL]
# Disable all to choose the Tests one by one
disable=all
# Tests
enable=bad-indentation, # Used when an unexpected number of indentation’s tabulations or spaces has been found.
mixed-indentation, # Used when there are some mixed tabs and spaces in a module.
unnecessary-semicolon, # Used when a statement is ended by a semi-colon (”;”), which isn’t necessary.
unused-variable # Used when a variable is defined but not used. (Use _var to ignore var).
...@@ -141,37 +141,37 @@ function run_tests { ...@@ -141,37 +141,37 @@ function run_tests {
PYTHON=python$PYTHON_VERSION PYTHON=python$PYTHON_VERSION
if [ -n "$IS_OSX" ]; then echo "Running for linux"
echo "Running for OS X"
cd ../tests
$PYTHON get_build_info.py
cd ../opencv/
export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata
else
echo "Running for linux"
if [ $PYTHON == "python3.6" ]; then
$PYTHON -m pip install -U numpy==1.19.4
fi
cd /io/tests
$PYTHON get_build_info.py
cd /io/opencv if [ $PYTHON == "python3.6" ]; then
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata $PYTHON -m pip install -U numpy==1.19.4
fi fi
cd /io/tests
$PYTHON get_build_info.py
cd /io/opencv
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
test_wheels test_wheels
pylint_test
} }
function test_wheels { function test_wheels {
echo "Starting tests..." echo "Starting OpenCV tests..."
#Test package #Test package
$PYTHON modules/python/test/test.py -v --repo . $PYTHON modules/python/test/test.py -v --repo .
} }
function pylint_test {
echo "Starting Pylint tests..."
$PYTHON -m pip install pylint==2.12.2
cd /io/tests
$PYTHON -m pylint /io/opencv/samples/python/squares.py
}
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x set -x
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册