Skip to content

Commit

Permalink
Merge pull request #3 from espressif/fix/windows_paths
Browse files Browse the repository at this point in the history
fix: windows paths
  • Loading branch information
hfudev authored Jan 13, 2025
2 parents 0c838b8 + 13e87f6 commit 95bb1e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ permissions:

jobs:
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.13"]
include:
- os: windows-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.13"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
3 changes: 1 addition & 2 deletions idf_ci/idf_pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ def pytest_pycollect_makemodule(
# redirect_stderr somehow breaks the sys.stderr.write() method
# fix it when implement proper logging
pkg = res.group(1)
if sys.__stderr__:
sys.__stderr__.write(f'WARNING:Mocking missed package while collecting: {pkg}\n')
logging.warning(f'WARNING:Mocking missed package while collecting: {pkg}\n')
sys.modules[pkg] = MagicMock()
continue
else:
Expand Down
10 changes: 6 additions & 4 deletions idf_ci/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os.path

import os
import re
import typing as t
from pathlib import Path
Expand Down Expand Up @@ -58,11 +59,12 @@ def get_modified_components(self, modified_files: t.Iterable[str]) -> t.Set[str]
if p.suffix in self.component_ignored_file_extensions + self.extend_component_ignored_file_extensions:
continue

# always use posix str
modified_file = Path(modified_file).as_posix()
# always use absolute path as posix string
# Path.resolve return relative path when file does not exist. so use os.path.abspath
modified_file = Path(os.path.abspath(modified_file)).as_posix()

for regex in self.all_component_mapping_regexes:
match = regex.search(os.path.abspath(modified_file))
match = regex.search(modified_file)
if match:
modified_components.add(match.group(1))
break
Expand Down

0 comments on commit 95bb1e4

Please sign in to comment.