From e6674484f3f768180e42f502c12b27a19c209e0d Mon Sep 17 00:00:00 2001 From: Teejay Date: Mon, 11 Sep 2023 15:20:01 -0700 Subject: [PATCH] Update CI (#7) --- .github/workflows/ci.yml | 14 +++++++++++--- pyproject.toml | 27 ++------------------------- pytest_timestamps/timestamp.py | 4 ++-- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2ff712..a2e0a88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install poetry tox tox-gh-actions - - name: Test with tox - run: tox + python -m pip install poetry + poetry install + - name: Format + run: poetry run black . + - name: Lint + run: poetry run ruff check . + - name: Test + run: poetry run pytest -v + - name: Type + run: poetry run mypy . + diff --git a/pyproject.toml b/pyproject.toml index 8c9e4e7..7af6fae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,28 +21,5 @@ timestamps = "pytest_timestamps.plugin" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.tox] -legacy_tox_ini = """ - [tox] - isolated_build = true - - env_list = - py37 - py38 - py39 - py310 - - [gh-actions] - python = - 3.7: py37 - 3.8: py38 - 3.9: py39 - 3.10: py310 - - [testenv] - allowlist_externals = - poetry - commands = - poetry install --only dev - poetry run pytest -v -""" +[tool.ruff] +select = ["A", "B", "E", "F", "I", "UP"] \ No newline at end of file diff --git a/pytest_timestamps/timestamp.py b/pytest_timestamps/timestamp.py index c6fa780..bff179a 100644 --- a/pytest_timestamps/timestamp.py +++ b/pytest_timestamps/timestamp.py @@ -4,7 +4,7 @@ from _pytest.reports import TestReport -def format(timestamp: float) -> str: +def _format(timestamp: float) -> str: return datetime.fromtimestamp(timestamp).strftime("%H:%M:%S") @@ -21,7 +21,7 @@ def _format(timestamp: float) -> str: return datetime.fromtimestamp(timestamp).strftime("%H:%M:%S") def get(self) -> str: - return f"[{format(self.start)} - {format(self.stop)}]" # type: ignore + return f"[{_format(self.start)} - {_format(self.stop)}]" # type: ignore def is_valid(self) -> bool: return bool(self.start and self.stop)