diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 24fc67c5e7800..4a1b724f3ce03 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -38,7 +38,7 @@ jobs: - name: Test with tox run: tox -c py/tox.ini env: - TOXENV: linting + TOXENV: linting-check tox_docs: if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }} diff --git a/py/tox.ini b/py/tox.ini index 6a4685e84967b..223c8d6f0de3c 100644 --- a/py/tox.ini +++ b/py/tox.ini @@ -30,6 +30,21 @@ py_version=37 force_single_line = True +[testenv:linting-check] +; checks linting for CI with stricter exiting when failing. +skip_install = true +deps = + isort==5.10.1 + black==22.8.0 + flake8==5.0.4 + flake8-typing-imports==1.13.0 +commands = + ; execute isort in check only mode. + isort --check-only --diff selenium/ test/ + ; execute black in check only mode with diff. + black --check --diff test/ selenium/common/ selenium/webdriver/safari -l 120 + flake8 selenium/ test/ --min-python-version=3.7 + [testenv:linting] ; A consolidated linting based recipe, responsible for executing linting tools across the code base. ; This encompasses isort for imports, black for general formatting and flake8.