Skip to content

Commit

Permalink
Update clp-ffi-py and development tools dependencies (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 authored Nov 26, 2023
1 parent 8beaa59 commit bcf9023
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- run: black --diff --check src/ tests/

- run: ruff check --format=github src/ tests/
- run: ruff check --output-format=github src/ tests/

- run: mypy src/ tests/

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "Logging/encoding/decoding using CLP's IR stream format"
readme = "README.md"
requires-python = ">=3.6"
dependencies = [
"clp-ffi-py >= 0.0.1",
"clp-ffi-py >= 0.0.9",
"python-dateutil >= 2.7.0",
"typing-extensions >= 3.7.4",
"zstandard >= 0.18.0",
Expand All @@ -24,11 +24,11 @@ classifiers = [

[project.optional-dependencies]
dev = [
"black >= 22.10.0",
"black >= 23.11.0",
"build >= 0.8.0",
"docformatter >= 1.5.1",
"mypy >= 0.982",
"ruff >= 0.0.275",
"ruff >= 0.1.5",
"types-python-dateutil >= 2.8.19.2",
]
test = [
Expand Down
40 changes: 19 additions & 21 deletions tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,25 +237,25 @@ def test_time_format_at_start(self) -> None:
self.clp_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
self.raw_handler.setFormatter(logging.Formatter(" [%(levelname)s] %(message)s"))
self.logger.info("format starts with %(asctime)s")
self.assert_clp_logs(
[f"{WARN_PREFIX.lstrip()} replacing '%(asctime)s' with clp_logging timestamp format"]
)
self.assert_clp_logs([
f"{WARN_PREFIX.lstrip()} replacing '%(asctime)s' with clp_logging timestamp format"
])

def test_time_format_in_middle(self) -> None:
fmt: str = "[%(levelname)s] %(asctime)s %(message)s"
self.clp_handler.setFormatter(logging.Formatter(fmt))
self.logger.info("format has %(asctime)s in the middle")
self.assert_clp_logs(
[f"{WARN_PREFIX.lstrip()} replacing '{fmt}' with '{DEFAULT_LOG_FORMAT}'"]
)
self.assert_clp_logs([
f"{WARN_PREFIX.lstrip()} replacing '{fmt}' with '{DEFAULT_LOG_FORMAT}'"
])

def test_time_format_missing(self) -> None:
self.clp_handler.setFormatter(logging.Formatter("[%(levelname)s] %(message)s"))
self.raw_handler.setFormatter(logging.Formatter(" [%(levelname)s] %(message)s"))
self.logger.info("no asctime in format")
self.assert_clp_logs(
[f"{WARN_PREFIX.lstrip()} prepending clp_logging timestamp to formatter"]
)
self.assert_clp_logs([
f"{WARN_PREFIX.lstrip()} prepending clp_logging timestamp to formatter"
])

def test_static(self) -> None:
self.logger.info("static text log one")
Expand Down Expand Up @@ -322,18 +322,16 @@ def test_bad_timeout_dicts(self) -> None:
self._setup_handler()

self.logger.debug("debug log0")
self.assert_clp_logs(
[
(
f"{WARN_PREFIX.lstrip()} log level {logging.DEBUG} not in"
" self.hard_timeout_deltas; defaulting to _HARD_TIMEOUT_DELTAS[logging.INFO]."
),
(
f"{WARN_PREFIX.lstrip()} log level {logging.DEBUG} not in"
" self.soft_timeout_deltas; defaulting to _SOFT_TIMEOUT_DELTAS[logging.INFO]."
),
]
)
self.assert_clp_logs([
(
f"{WARN_PREFIX.lstrip()} log level {logging.DEBUG} not in"
" self.hard_timeout_deltas; defaulting to _HARD_TIMEOUT_DELTAS[logging.INFO]."
),
(
f"{WARN_PREFIX.lstrip()} log level {logging.DEBUG} not in"
" self.soft_timeout_deltas; defaulting to _SOFT_TIMEOUT_DELTAS[logging.INFO]."
),
])

def _test_timeout(
self,
Expand Down

0 comments on commit bcf9023

Please sign in to comment.