Skip to content

Commit

Permalink
Use Optional for type hints to ensure backward compatibility.
Browse files Browse the repository at this point in the history
Replaced PEP 604 union syntax (|) with Optional for type hints to maintain compatibility with Python versions earlier than 3.10.
  • Loading branch information
marcelotrevisani committed Feb 3, 2025
1 parent e0f10c4 commit a0dae93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/pytest_replay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dataclasses import asdict
from glob import glob
from typing import Any
from typing import Optional

import pytest

Expand Down Expand Up @@ -47,8 +48,8 @@ def pytest_addoption(parser):
class ReplayTestMetadata:
nodeid: str
start: float = 0.0
finish: float | None = None
outcome: str | None = None
finish: Optional[float] = None
outcome: Optional[str] = None
metadata: dict[str, Any] = dataclasses.field(default_factory=dict)

def to_clean_dict(self) -> dict[str, Any]:
Expand Down Expand Up @@ -160,8 +161,6 @@ def pytest_collection_modifyitems(self, items, config):
config.hook.pytest_deselected(items=deselected)

items[:] = remaining
# for nodeid in remaining:
# self.nodes[nodeid].metadata =

def append_test_to_script(self, nodeid, line):
suffix = "-" + self.xdist_worker_name if self.xdist_worker_name else ""
Expand Down

0 comments on commit a0dae93

Please sign in to comment.