From aa87b2e473397e79ba6ad43a7fb0712d28c71e94 Mon Sep 17 00:00:00 2001 From: Maria Knorps Date: Wed, 25 Oct 2023 12:15:51 +0200 Subject: [PATCH] Test of 'nul' for Windows checks --- .github/workflows/format.yaml | 3 ++- .github/workflows/lint.yaml | 2 +- .github/workflows/self_test.yaml | 2 +- tests/utils.py | 10 +++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 7e4ded3e..b0680061 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -8,7 +8,8 @@ jobs: fail-fast: false matrix: python-version: ["3.11"] - os: [macos-latest, windows-latest, ubuntu-latest] + # os: [macos-latest, windows-latest, ubuntu-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2591fed7..dd72b8c4 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - os: [macos-latest, windows-latest, ubuntu-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/self_test.yaml b/.github/workflows/self_test.yaml index bad470c2..25f83d6b 100644 --- a/.github/workflows/self_test.yaml +++ b/.github/workflows/self_test.yaml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - os: [macos-latest, windows-latest, ubuntu-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/tests/utils.py b/tests/utils.py index 417bf9de..c5ab5fa2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,6 +4,7 @@ import logging import os import subprocess +import sys from dataclasses import dataclass, field, replace from pathlib import Path from textwrap import dedent @@ -101,9 +102,16 @@ def unused_factory(*deps: str) -> List[UnusedDependency]: return [UnusedDependency(dep, [Location(Path("foo"))]) for dep in deps] +def _config_file_name(): + if sys.platform.startswith("win"): + return Path("nul") + else: + return Path("/dev/null") + + def run_fawltydeps_subprocess( *args: str, - config_file: Path = Path("/dev/null"), + config_file: Path = _config_file_name(), to_stdin: Optional[str] = None, cwd: Optional[Path] = None, ) -> Tuple[str, str, int]: