Skip to content

Commit 7d87c3f

Browse files
committed
conftest.py: Ignore exit status 5 (no tests collected)
This change is necessary because we skip all tests when running on GitHub Actions. This is done to avoid running tests that require a serial attached micropython board.
1 parent 0c17f23 commit 7d87c3f

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ version.raw-options.git_describe_command = [
5555
[tool.uv]
5656
dev-dependencies = [
5757
# For development environment, including type checking
58-
"types-pyserial>=3.5",
58+
"types-pyserial>=3.5", # For type checking pyserial (needed by mpremote)
5959
# For running tests: pytest, pyyaml, requests, tox, mypy, ruff
60+
"pyyaml>=6.0.0", # For logging configuration in tests/
61+
"types-pyyaml>=6.0.0",
6062
"pytest>=8.3.2",
6163
"pytest-cov>=3.0.0",
62-
"pyyaml>=6.0.2", # For logging configuration in tests/
6364
"mypy>=0.910", # For code type checks: uv run mypy --no-sources mypy src
6465
"ruff>=0.6.7", # For linting: uv run --no-sources ruff format --check src
6566
"tox>=4.0.0",
@@ -107,7 +108,7 @@ env.clean.commands = [["coverage", "erase"]] # Cleanup coverage data
107108
env.clean.deps = ["coverage"]
108109
env.clean.skip_install = true
109110
env.mypy.commands = [["mypy"]]
110-
env.mypy.deps = ["mypy", "types-pyserial"]
111+
env.mypy.deps = ["mypy", "types-pyserial", "types-pyyaml"]
111112
env.lint.commands = [["ruff", "check"]]
112113
env.lint.deps = ["ruff"]
113114
env.format.commands = [["ruff", "format", "--check"]]

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ def pytest_addoption(parser: argparse.Namespace) -> None:
4646
)
4747

4848

49+
def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None:
50+
# Ignore exit status 5 (no tests collected)
51+
# We skip all tests when running on GitHub Actions
52+
if exitstatus == 5:
53+
session.exitstatus = 0 # Ignore exit status 5 (no tests collected)
54+
55+
4956
def rm_recursive(path: Path) -> None:
5057
"""Remove a directory and all it's contents recursively."""
5158
if not path.exists():

uv.lock

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)