Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
This appeases mypy (once the version is upgraded in the pre-commit config
file) and removes some superfluous bits.

Thanks @bmerry for the suggestions.

Co-authored-by: Bruce Merry <1963944+bmerry@users.noreply.github.com>
  • Loading branch information
ludwigschwardt and bmerry committed Sep 11, 2023
1 parent 37e5c33 commit 92f685c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/aiokatcp/adjtimex.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ def _errcheck(result, func, args):
except OSError:
adjtimex = _no_adjtimex
else:
adjtimex = _libc.adjtimex
adjtimex.argtypes = [ctypes.POINTER(Timex)] # type: ignore[attr-defined]
adjtimex.restype = ctypes.c_int # type: ignore[attr-defined]
adjtimex.errcheck = _errcheck # type: ignore[attr-defined]
_real_adjtimex = _libc.adjtimex
_real_adjtimex.argtypes = [ctypes.POINTER(Timex)]
_real_adjtimex.restype = ctypes.c_int
_real_adjtimex.errcheck = _errcheck
adjtimex = _real_adjtimex


def get_adjtimex() -> Tuple[int, Timex]:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_time_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ def mock_adjtimex(mocker, request) -> None:


_linux = pytest.mark.skipif(
not sys.platform.startswith("linux"),
sys.platform != "linux",
reason="Check real adjtimex on Linux systems only",
)
_non_linux = pytest.mark.skipif(
sys.platform.startswith("linux"),
sys.platform == "linux",
reason="Check unimplemented adjtimex on non-Linux systems only",
)


@pytest.mark.parametrize(
("expected_status",),
"expected_status",
[
pytest.param(Sensor.Status.NOMINAL, marks=_linux),
pytest.param(Sensor.Status.INACTIVE, marks=_non_linux),
Expand Down

0 comments on commit 92f685c

Please sign in to comment.