Merge branch 'fix/pytest_session_dir' into 'master'

ci: apply new fix in pytest-embedded 1.10

See merge request espressif/esp-idf!30660
This commit is contained in:
Fu Hanxi 2024-05-07 18:01:20 +08:00
commit 6354a793e0
3 changed files with 9 additions and 16 deletions

View File

@ -103,10 +103,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'
- 'types-requests' - 'types-requests'
exclude: > exclude: >
(?x)^( (?x)^(

View File

@ -25,7 +25,6 @@ import re
import typing as t import typing as t
import zipfile import zipfile
from copy import deepcopy from copy import deepcopy
from datetime import datetime
from urllib.parse import quote from urllib.parse import quote
import common_test_methods # noqa: F401 import common_test_methods # noqa: F401
@ -56,15 +55,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

@ -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)