From 9f21460e10149ae0bc30599d00821aa439f978bc Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Tue, 7 May 2024 09:16:54 +0200 Subject: [PATCH 1/3] ci: update mypy check for python 3.12, check under python 3.8 rules --- .pre-commit-config.yaml | 8 ++++---- tools/ci/check_type_comments.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48dffffb5c..7fc840d90c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -112,10 +112,10 @@ repos: name: Check type annotations in python files entry: tools/ci/check_type_comments.py additional_dependencies: - - 'mypy==0.940' - - 'mypy-extensions==0.4.3' - - 'types-setuptools==57.4.14' - - 'types-PyYAML==0.1.9' + - 'mypy' + - 'mypy-extensions' + - 'types-setuptools' + - 'types-PyYAML' exclude: > (?x)^( .*_pb2.py diff --git a/tools/ci/check_type_comments.py b/tools/ci/check_type_comments.py index d89bf562b2..38865b0842 100755 --- a/tools/ci/check_type_comments.py +++ b/tools/ci/check_type_comments.py @@ -2,7 +2,6 @@ # # SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 - import argparse import subprocess from sys import exit @@ -30,7 +29,7 @@ def types_valid_ignored_rules(file_name): # type: (str) -> bool """ Run Mypy check with rules for ignore list on the given file, return TRUE if Mypy check passes """ - mypy_exit_code = subprocess.call('mypy {} --allow-untyped-defs'.format(file_name), shell=True) + mypy_exit_code = subprocess.call('mypy {} --python-version 3.8 --allow-untyped-defs'.format(file_name), shell=True) return not bool(mypy_exit_code) From 899fc7cd4fdc48a916ddba1c02ef111cc8d08e1d Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Tue, 7 May 2024 09:19:00 +0200 Subject: [PATCH 2/3] ci: apply new fix in pytest-embedded 1.10 --- conftest.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/conftest.py b/conftest.py index cf127e7fe9..2f13c78aa9 100644 --- a/conftest.py +++ b/conftest.py @@ -20,7 +20,6 @@ import os import re import sys from copy import deepcopy -from datetime import datetime from typing import Callable, Optional import pytest @@ -58,15 +57,10 @@ def idf_path() -> str: return os.path.dirname(__file__) -@pytest.fixture(scope='session', autouse=True) -def session_tempdir() -> str: - _tmpdir = os.path.join( - os.path.dirname(__file__), - 'pytest_embedded_log', - datetime.now().strftime('%Y-%m-%d_%H-%M-%S'), - ) - os.makedirs(_tmpdir, exist_ok=True) - return _tmpdir +@pytest.fixture(scope='session') +def session_root_logdir(idf_path: str) -> str: + """Session scoped log dir for pytest-embedded""" + return idf_path @pytest.fixture From 120a15b83f0335ae1e1a3b1984858f34196331b9 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Thu, 9 May 2024 10:32:52 +0200 Subject: [PATCH 3/3] ci: move log dir from pytest_embedded_log to pytest-embedded --- .gitignore | 2 ++ .gitlab/ci/host-test.yml | 4 ++-- .gitlab/ci/target-test.yml | 2 +- pytest.ini | 2 ++ tools/ci/idf_ci_utils.py | 9 ++++----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 7aa73b086b..8c38351657 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,8 @@ dependencies.lock managed_components # pytest log +pytest-embedded/ +# legacy one pytest_embedded_log/ list_job_*.txt size_info.txt diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index 49ece921d7..10141c01ba 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -291,7 +291,7 @@ test_pytest_qemu: when: always paths: - XUNIT_RESULT.xml - - pytest_embedded_log/ + - pytest-embedded/ reports: junit: XUNIT_RESULT.xml expire_in: 1 week @@ -324,7 +324,7 @@ test_pytest_linux: when: always paths: - XUNIT_RESULT.xml - - pytest_embedded_log/ + - pytest-embedded/ - "**/build*/build_log.txt" reports: junit: XUNIT_RESULT.xml diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index c9a77a7a06..f2519d8de8 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -21,7 +21,7 @@ when: always paths: - XUNIT_RESULT.xml - - pytest_embedded_log/ + - pytest-embedded/ reports: junit: XUNIT_RESULT.xml expire_in: 1 week diff --git a/pytest.ini b/pytest.ini index c9c0c43560..069d1cf415 100644 --- a/pytest.ini +++ b/pytest.ini @@ -12,6 +12,8 @@ addopts = --skip-check-coredump y --logfile-extension ".txt" --check-duplicates y + --ignore-glob */managed_components/* + --ignore pytest-embedded # ignore DeprecationWarning filterwarnings = diff --git a/tools/ci/idf_ci_utils.py b/tools/ci/idf_ci_utils.py index 1776766eaf..f58de750ba 100644 --- a/tools/ci/idf_ci_utils.py +++ b/tools/ci/idf_ci_utils.py @@ -1,16 +1,15 @@ -# SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 - # internal use only for CI # some CI related util functions - import logging import os import subprocess import sys -from typing import Any, List +from typing import Any +from typing import List -IDF_PATH = os.path.abspath(os.getenv('IDF_PATH', os.path.join(os.path.dirname(__file__), '..', '..'))) +IDF_PATH: str = os.path.abspath(os.getenv('IDF_PATH', os.path.join(os.path.dirname(__file__), '..', '..'))) def get_submodule_dirs(full_path: bool = False) -> List[str]: