Merge branch 'fix/pytest_session_dir_v5.2' into 'release/v5.2'

ci: apply new fix in pytest-embedded 1.10 (v5.2)

See merge request espressif/esp-idf!30677
This commit is contained in:
Fu Hanxi 2024-06-05 16:22:44 +08:00
commit 05872cfc2d
8 changed files with 20 additions and 24 deletions

2
.gitignore vendored
View File

@ -100,6 +100,8 @@ dependencies.lock
managed_components managed_components
# pytest log # pytest log
pytest-embedded/
# legacy one
pytest_embedded_log/ pytest_embedded_log/
list_job_*.txt list_job_*.txt
size_info.txt size_info.txt

View File

@ -291,7 +291,7 @@ test_pytest_qemu:
when: always when: always
paths: paths:
- XUNIT_RESULT.xml - XUNIT_RESULT.xml
- pytest_embedded_log/ - pytest-embedded/
reports: reports:
junit: XUNIT_RESULT.xml junit: XUNIT_RESULT.xml
expire_in: 1 week expire_in: 1 week
@ -324,7 +324,7 @@ test_pytest_linux:
when: always when: always
paths: paths:
- XUNIT_RESULT.xml - XUNIT_RESULT.xml
- pytest_embedded_log/ - pytest-embedded/
- "**/build*/build_log.txt" - "**/build*/build_log.txt"
reports: reports:
junit: XUNIT_RESULT.xml junit: XUNIT_RESULT.xml

View File

@ -21,7 +21,7 @@
when: always when: always
paths: paths:
- XUNIT_RESULT.xml - XUNIT_RESULT.xml
- pytest_embedded_log/ - pytest-embedded/
reports: reports:
junit: XUNIT_RESULT.xml junit: XUNIT_RESULT.xml
expire_in: 1 week expire_in: 1 week

View File

@ -112,10 +112,10 @@ repos:
name: Check type annotations in python files name: Check type annotations in python files
entry: tools/ci/check_type_comments.py entry: tools/ci/check_type_comments.py
additional_dependencies: additional_dependencies:
- 'mypy==0.940' - 'mypy'
- 'mypy-extensions==0.4.3' - 'mypy-extensions'
- 'types-setuptools==57.4.14' - 'types-setuptools'
- 'types-PyYAML==0.1.9' - 'types-PyYAML'
exclude: > exclude: >
(?x)^( (?x)^(
.*_pb2.py .*_pb2.py

View File

@ -20,7 +20,6 @@ import os
import re import re
import sys import sys
from copy import deepcopy from copy import deepcopy
from datetime import datetime
from typing import Callable, Optional from typing import Callable, Optional
import pytest import pytest
@ -58,15 +57,10 @@ def idf_path() -> str:
return os.path.dirname(__file__) return os.path.dirname(__file__)
@pytest.fixture(scope='session', autouse=True) @pytest.fixture(scope='session')
def session_tempdir() -> str: def session_root_logdir(idf_path: str) -> str:
_tmpdir = os.path.join( """Session scoped log dir for pytest-embedded"""
os.path.dirname(__file__), return idf_path
'pytest_embedded_log',
datetime.now().strftime('%Y-%m-%d_%H-%M-%S'),
)
os.makedirs(_tmpdir, exist_ok=True)
return _tmpdir
@pytest.fixture @pytest.fixture

View File

@ -12,6 +12,8 @@ addopts =
--skip-check-coredump y --skip-check-coredump y
--logfile-extension ".txt" --logfile-extension ".txt"
--check-duplicates y --check-duplicates y
--ignore-glob */managed_components/*
--ignore pytest-embedded
# ignore DeprecationWarning # ignore DeprecationWarning
filterwarnings = filterwarnings =

View File

@ -2,7 +2,6 @@
# #
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import argparse import argparse
import subprocess import subprocess
from sys import exit 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 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) return not bool(mypy_exit_code)

View File

@ -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 # SPDX-License-Identifier: Apache-2.0
# internal use only for CI # internal use only for CI
# some CI related util functions # some CI related util functions
import logging import logging
import os import os
import subprocess import subprocess
import sys 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]: def get_submodule_dirs(full_path: bool = False) -> List[str]: