Enable pylint on tests (#119279)
* Enable pylint on tests * Remove jobs==1
This commit is contained in:
parent
7c5fcec062
commit
325a49e8ff
3 changed files with 46 additions and 4 deletions
45
.github/workflows/ci.yaml
vendored
45
.github/workflows/ci.yaml
vendored
|
@ -620,6 +620,51 @@ jobs:
|
||||||
python --version
|
python --version
|
||||||
pylint --ignore-missing-annotations=y homeassistant/components/${{ needs.info.outputs.integrations_glob }}
|
pylint --ignore-missing-annotations=y homeassistant/components/${{ needs.info.outputs.integrations_glob }}
|
||||||
|
|
||||||
|
pylint-tests:
|
||||||
|
name: Check pylint on tests
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
timeout-minutes: 20
|
||||||
|
if: |
|
||||||
|
github.event.inputs.mypy-only != 'true'
|
||||||
|
|| github.event.inputs.pylint-only == 'true'
|
||||||
|
needs:
|
||||||
|
- info
|
||||||
|
- base
|
||||||
|
steps:
|
||||||
|
- name: Check out code from GitHub
|
||||||
|
uses: actions/checkout@v4.1.6
|
||||||
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||||
|
id: python
|
||||||
|
uses: actions/setup-python@v5.1.0
|
||||||
|
with:
|
||||||
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||||
|
check-latest: true
|
||||||
|
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
|
||||||
|
id: cache-venv
|
||||||
|
uses: actions/cache/restore@v4.0.2
|
||||||
|
with:
|
||||||
|
path: venv
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
key: >-
|
||||||
|
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||||
|
needs.info.outputs.python_cache_key }}
|
||||||
|
- name: Register pylint problem matcher
|
||||||
|
run: |
|
||||||
|
echo "::add-matcher::.github/workflows/matchers/pylint.json"
|
||||||
|
- name: Run pylint (fully)
|
||||||
|
if: needs.info.outputs.test_full_suite == 'true'
|
||||||
|
run: |
|
||||||
|
. venv/bin/activate
|
||||||
|
python --version
|
||||||
|
pylint --ignore-missing-annotations=y tests
|
||||||
|
- name: Run pylint (partially)
|
||||||
|
if: needs.info.outputs.test_full_suite == 'false'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. venv/bin/activate
|
||||||
|
python --version
|
||||||
|
pylint --ignore-missing-annotations=y tests/components/${{ needs.info.outputs.integrations_glob }}
|
||||||
|
|
||||||
mypy:
|
mypy:
|
||||||
name: Check mypy
|
name: Check mypy
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
|
@ -69,7 +69,7 @@ repos:
|
||||||
entry: script/run-in-env.sh pylint -j 0 --ignore-missing-annotations=y
|
entry: script/run-in-env.sh pylint -j 0 --ignore-missing-annotations=y
|
||||||
language: script
|
language: script
|
||||||
types_or: [python, pyi]
|
types_or: [python, pyi]
|
||||||
files: ^homeassistant/.+\.(py|pyi)$
|
files: ^(homeassistant|tests)/.+\.(py|pyi)$
|
||||||
- id: gen_requirements_all
|
- id: gen_requirements_all
|
||||||
name: gen_requirements_all
|
name: gen_requirements_all
|
||||||
entry: script/run-in-env.sh python3 -m script.gen_requirements_all
|
entry: script/run-in-env.sh python3 -m script.gen_requirements_all
|
||||||
|
|
|
@ -93,9 +93,6 @@ include = ["homeassistant*"]
|
||||||
|
|
||||||
[tool.pylint.MAIN]
|
[tool.pylint.MAIN]
|
||||||
py-version = "3.12"
|
py-version = "3.12"
|
||||||
ignore = [
|
|
||||||
"tests",
|
|
||||||
]
|
|
||||||
# Use a conservative default here; 2 should speed up most setups and not hurt
|
# Use a conservative default here; 2 should speed up most setups and not hurt
|
||||||
# any too bad. Override on command line as appropriate.
|
# any too bad. Override on command line as appropriate.
|
||||||
jobs = 2
|
jobs = 2
|
||||||
|
|
Loading…
Add table
Reference in a new issue