Skip to content

Commit

Permalink
Rebrand to logot (#4)
Browse files Browse the repository at this point in the history
It turns out the `log-test` library already exists, and PyPI rejects
packages with too-similar names.

Anyway, since this library is all about waiting for logs, `logot` is a
fantastic pun opportunity!
  • Loading branch information
etianen authored Jan 15, 2024
1 parent 1628e4c commit 6aba6cf
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/.coverage
/.mypy_cache
/.venv
/dist
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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) 📖
4 changes: 4 additions & 0 deletions logot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from __future__ import annotations

from logot import match as match
from logot import util as util
2 changes: 1 addition & 1 deletion logtest/match.py → logot/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions logtest/__init__.py

This file was deleted.

20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[tool.poetry]
name = "logtest"
version = "0.0.1-a0"
name = "logot"
version = "0.0.1-a1"
description = "Log-based testing"
authors = ["Dave Hall <dave@etianen.com>"]
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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
12 changes: 6 additions & 6 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 6aba6cf

Please sign in to comment.