diff --git a/.gitignore b/.gitignore index 56d6c50e..544c26c8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /.coverage /.mypy_cache /.venv +/dist diff --git a/README.md b/README.md index baa9a3aa..93a754f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Log-based testing -[![Build](https://github.com/etianen/logtest/actions/workflows/build.yml/badge.svg)](https://github.com/etianen/logtest/actions/workflows/build.yml) +[![Build](https://github.com/etianen/logot/actions/workflows/build.yml/badge.svg)](https://github.com/etianen/logot/actions/workflows/build.yml) -📖 [Read the docs](https://logtest.readthedocs.io) 📖 +📖 [Read the docs](https://logot.readthedocs.io) 📖 diff --git a/logot/__init__.py b/logot/__init__.py new file mode 100644 index 00000000..2f144a45 --- /dev/null +++ b/logot/__init__.py @@ -0,0 +1,4 @@ +from __future__ import annotations + +from logot import match as match +from logot import util as util diff --git a/logtest/match.py b/logot/match.py similarity index 97% rename from logtest/match.py rename to logot/match.py index 831f8be2..0d9bbbb7 100644 --- a/logtest/match.py +++ b/logot/match.py @@ -3,7 +3,7 @@ import logging from abc import ABC, abstractmethod -from logtest.util import check_level +from logot.util import check_level class Matcher(ABC): diff --git a/logtest/util.py b/logot/util.py similarity index 100% rename from logtest/util.py rename to logot/util.py diff --git a/logtest/__init__.py b/logtest/__init__.py deleted file mode 100644 index 853e2bba..00000000 --- a/logtest/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from __future__ import annotations - -from logtest import match as match -from logtest import util as util diff --git a/pyproject.toml b/pyproject.toml index 70bb8870..57d57d2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,15 @@ [tool.poetry] -name = "logtest" +name = "logot" version = "0.0.1-a0" description = "Log-based testing" authors = ["Dave Hall "] license = "MIT" readme = "README.md" -homepage = "https://logtest.readthedocs.io" -repository = "https://github.com/etianen/logtest" -documentation = "https://logtest.readthedocs.io" -keywords = ["test", "unittest", "pytest"] -packages = [{ include = "logtest" }] +homepage = "https://logot.readthedocs.io" +repository = "https://github.com/etianen/logot" +documentation = "https://logot.readthedocs.io" +keywords = ["test", "unittest", "pytest", "logging"] +packages = [{ include = "logot" }] [tool.poetry.dependencies] python = "^3.8" @@ -25,7 +25,7 @@ pytest = "*" pytest-cov = "^4.1.0" [tool.coverage.run] -source = ["logtest", "tests"] +source = ["logot", "tests"] [tool.coverage.report] show_missing = true @@ -41,7 +41,7 @@ exclude_lines = [ ] [tool.mypy] -files = ["logtest/**/*.py", "tests/**/*.py"] +files = ["logot/**/*.py", "tests/**/*.py"] allow_redefinition = true explicit_package_bases = true show_column_numbers = true @@ -53,7 +53,7 @@ console_output_style = "classic" addopts = "--tb=native --cov" [tool.ruff] -include = ["logtest/**/*.py", "tests/**/*.py"] +include = ["logot/**/*.py", "tests/**/*.py"] line-length = 120 select = ["E", "F", "W", "I", "UP"] diff --git a/tests/__init__.py b/tests/__init__.py index 7b09c82c..0e160589 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -9,7 +9,7 @@ def createLogRecord( message: str = "Hello world", ) -> logging.LogRecord: return logging.LogRecord( - name="logtest", + name="logot", level=level, pathname=__file__, lineno=1, diff --git a/tests/test_match.py b/tests/test_match.py index 271a8f88..8d9dfc2e 100644 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -2,37 +2,37 @@ import logging -import logtest +import logot from tests import createLogRecord def test_level_match_pass() -> None: - assert logtest.match.level(logging.INFO).match(createLogRecord(level=logging.INFO)) + assert logot.match.level(logging.INFO).match(createLogRecord(level=logging.INFO)) def test_level_match_fail() -> None: - assert not logtest.match.level(logging.INFO).match(createLogRecord(level=logging.WARN)) + assert not logot.match.level(logging.INFO).match(createLogRecord(level=logging.WARN)) def test_level_repr() -> None: - assert repr(logtest.match.level(logging.INFO)) == "level('INFO')" + assert repr(logot.match.level(logging.INFO)) == "level('INFO')" def test_level_str() -> None: - assert str(logtest.match.level(logging.INFO)) == "[INFO]" + assert str(logot.match.level(logging.INFO)) == "[INFO]" def test_message_match_pass() -> None: - assert logtest.match.message("Hello world").match(createLogRecord(message="Hello world")) + assert logot.match.message("Hello world").match(createLogRecord(message="Hello world")) def test_message_match_fail() -> None: - assert not logtest.match.message("Hello world").match(createLogRecord(message="BOOM")) + assert not logot.match.message("Hello world").match(createLogRecord(message="BOOM")) def test_message_repr() -> None: - assert repr(logtest.match.message("Hello world")) == "message('Hello world')" + assert repr(logot.match.message("Hello world")) == "message('Hello world')" def test_message_str() -> None: - assert str(logtest.match.message("Hello world")) == "Hello world" + assert str(logot.match.message("Hello world")) == "Hello world" diff --git a/tests/test_util.py b/tests/test_util.py index 98a6319b..6cef98a9 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -4,30 +4,30 @@ import pytest -import logtest +import logot def test_check_level_int_pass() -> None: - assert logtest.util.check_level(logging.INFO) == logging.INFO + assert logot.util.check_level(logging.INFO) == logging.INFO def test_check_level_int_fail() -> None: with pytest.raises(ValueError) as ex: - logtest.util.check_level(9999) + logot.util.check_level(9999) assert str(ex.value) == "Unknown level: 9999" def test_check_level_str_pass() -> None: - assert logtest.util.check_level("INFO") == logging.INFO + assert logot.util.check_level("INFO") == logging.INFO def test_check_level_str_fail() -> None: with pytest.raises(ValueError) as ex: - logtest.util.check_level("BOOM") + logot.util.check_level("BOOM") assert str(ex.value) == "Unknown level: 'BOOM'" def test_check_level_type_fail() -> None: with pytest.raises(TypeError) as ex: - logtest.util.check_level(1.5) # type: ignore[arg-type] + logot.util.check_level(1.5) # type: ignore[arg-type] assert str(ex.value) == "Invalid level: 1.5"