Skip to content

Added pylint test #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: false
submodules: true
fetch-depth: 0

- name: Setup Environment variables
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build_wheels_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
CONFIG_PATH: travis_config.sh
PLAT: x86_64
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py

steps:
- name: Checkout
Expand Down Expand Up @@ -171,6 +172,12 @@ jobs:
cd ${{ github.workspace }}/opencv
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:
if: github.event_name == 'release' && github.event.release.prerelease
needs: [build, test]
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build_wheels_macos_m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:

env:
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py

steps:
- name: Checkout
Expand All @@ -106,6 +107,12 @@ jobs:
cd ${{ github.workspace }}/opencv
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:
if: github.event_name == 'release' && github.event.release.prerelease
needs: [build, test]
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build_wheels_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py

steps:
- name: Checkout
Expand Down Expand Up @@ -130,6 +131,13 @@ jobs:
python modules\python\test\test.py -v --repo .
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:
if: github.event_name == 'release' && github.event.release.prerelease
needs: [build-windows-x86_64, test]
Expand Down
12 changes: 12 additions & 0 deletions tests/pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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).
38 changes: 19 additions & 19 deletions travis_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,37 +141,37 @@ function run_tests {

PYTHON=python$PYTHON_VERSION

if [ -n "$IS_OSX" ]; then
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
echo "Running for linux"

cd /io/opencv
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
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
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata

test_wheels
pylint_test
}

function test_wheels {

echo "Starting tests..."
echo "Starting OpenCV tests..."

#Test package
$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]}(): }'
set -x