From 42a2b7acd38576efcfcd3130addf7dd3d8dc6ad8 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Sat, 27 Jan 2024 14:50:30 +0000 Subject: [PATCH 1/3] Moving `pytest` plugin into the package namespace --- _logot_pytest.py | 19 ------------------- logot/_pytest.py | 13 +++++++++++++ pyproject.toml | 4 ++-- 3 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 _logot_pytest.py create mode 100644 logot/_pytest.py diff --git a/_logot_pytest.py b/_logot_pytest.py deleted file mode 100644 index 26e8bf34..00000000 --- a/_logot_pytest.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import annotations - -from collections.abc import Generator -from typing import TYPE_CHECKING - -import pytest - -if TYPE_CHECKING: - # Don't import `logot` until the fixture runs. - # This avoids problem with pytest coverage reporting. - from logot import Logot - - -@pytest.fixture() -def logot() -> Generator[Logot, None, None]: - from logot import Logot - - with Logot().capturing() as logot: - yield logot diff --git a/logot/_pytest.py b/logot/_pytest.py new file mode 100644 index 00000000..f190f8cc --- /dev/null +++ b/logot/_pytest.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +from collections.abc import Generator + +import pytest + +from logot._logot import Logot + + +@pytest.fixture() +def logot() -> Generator[Logot, None, None]: + with Logot().capturing() as logot: + yield logot diff --git a/pyproject.toml b/pyproject.toml index d30a63a6..417ff007 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ "Topic :: System :: Logging", "Typing :: Typed", ] -packages = [{ include = "logot" }, { include = "_logot_pytest.py" }] +packages = [{ include = "logot" }] [tool.poetry.dependencies] python = "^3.8" @@ -43,7 +43,7 @@ sphinx = { version = "7.2.6", markers = "python_version >= '3.12'" } sphinx-autobuild = { version = "*", markers = "python_version >= '3.12'" } [tool.poetry.plugins.pytest11] -logot = "_logot_pytest" +logot = "logot._pytest" [tool.coverage.run] source = ["logot", "tests"] From 307d7ca22a331ecce620353482d663b8ba264895 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Sat, 27 Jan 2024 14:52:09 +0000 Subject: [PATCH 2/3] wip --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 417ff007..1ce8565b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "logot" -version = "0.1.0" +version = "0.1.1" description = "Log-based testing" authors = ["Dave Hall "] license = "MIT" From c022eddf4df73634a7628ad3a72d223394182dca Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Sat, 27 Jan 2024 14:52:22 +0000 Subject: [PATCH 3/3] wip --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1ce8565b..417ff007 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "logot" -version = "0.1.1" +version = "0.1.0" description = "Log-based testing" authors = ["Dave Hall "] license = "MIT"