forked from espressif/esp-idf
Merge branch 'fix/pytest_session_dir_v5.1' into 'release/v5.1'
ci: apply new fix in pytest-embedded 1.10 (v5.1) See merge request espressif/esp-idf!30678
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -96,4 +96,6 @@ dependencies.lock
|
|||||||
managed_components
|
managed_components
|
||||||
|
|
||||||
# pytest log
|
# pytest log
|
||||||
|
pytest-embedded/
|
||||||
|
# legacy one
|
||||||
pytest_embedded_log/
|
pytest_embedded_log/
|
||||||
|
@@ -307,7 +307,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
|
||||||
@@ -332,7 +332,7 @@ test_pytest_linux:
|
|||||||
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
|
||||||
|
@@ -19,7 +19,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
|
||||||
|
@@ -104,10 +104,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
|
||||||
|
16
conftest.py
16
conftest.py
@@ -15,7 +15,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from datetime import datetime
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
from typing import List
|
from typing import List
|
||||||
@@ -183,7 +182,7 @@ def item_skip_targets(item: Item) -> List[str]:
|
|||||||
# temp markers should always use keyword arguments `targets` and `reason`
|
# temp markers should always use keyword arguments `targets` and `reason`
|
||||||
if not temp_marker.kwargs.get('targets') or not temp_marker.kwargs.get('reason'):
|
if not temp_marker.kwargs.get('targets') or not temp_marker.kwargs.get('reason'):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f'`{marker_name}` should always use keyword arguments `targets` and `reason`. '
|
f'`{marker_name}` should always use keyword arguments `targets` and `reason`. ' # noqa
|
||||||
f'For example: '
|
f'For example: '
|
||||||
f'`@pytest.mark.{marker_name}(targets=["esp32"], reason="IDF-xxxx, will fix it ASAP")`'
|
f'`@pytest.mark.{marker_name}(targets=["esp32"], reason="IDF-xxxx, will fix it ASAP")`'
|
||||||
)
|
)
|
||||||
@@ -227,15 +226,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
|
||||||
|
@@ -13,6 +13,7 @@ addopts =
|
|||||||
--logfile-extension ".txt"
|
--logfile-extension ".txt"
|
||||||
--check-duplicates y
|
--check-duplicates y
|
||||||
--ignore-glob "*/managed_components/*"
|
--ignore-glob "*/managed_components/*"
|
||||||
|
--ignore pytest-embedded
|
||||||
|
|
||||||
# ignore DeprecationWarning
|
# ignore DeprecationWarning
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
|
@@ -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.7 --allow-untyped-defs'.format(file_name), shell=True)
|
||||||
return not bool(mypy_exit_code)
|
return not bool(mypy_exit_code)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# internal use only for CI
|
# internal use only for CI
|
||||||
# some CI related util functions
|
# some CI related util functions
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: 2020-2022 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
|
||||||
#
|
#
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -13,7 +13,12 @@ import sys
|
|||||||
from contextlib import redirect_stdout
|
from contextlib import redirect_stdout
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional, Set, Union
|
from typing import Any
|
||||||
|
from typing import List
|
||||||
|
from typing import Optional
|
||||||
|
from typing import Set
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from idf_py_actions.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS
|
from idf_py_actions.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS
|
||||||
@@ -25,7 +30,7 @@ except ImportError:
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from _pytest.python import Function
|
from _pytest.python import Function
|
||||||
|
|
||||||
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]:
|
||||||
|
Reference in New Issue
Block a user