Skip to content

Commit

Permalink
Update linter and test dependencies to fix the failed workflow. (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 authored Apr 19, 2024
1 parent 9a771e9 commit 3d69466
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ classifiers = [

[project.optional-dependencies]
dev = [
"black >= 23.11.0",
"black >= 24.4.0",
"build >= 0.8.0",
"docformatter >= 1.5.1",
"mypy >= 0.982",
"ruff >= 0.1.5",
"docformatter >= 1.7.5",
"mypy >= 1.9.0",
"ruff >= 0.3.7",
"types-python-dateutil >= 2.8.19.2",
]
test = [
Expand Down Expand Up @@ -58,10 +58,10 @@ pretty = true

[tool.ruff]
line-length = 100
select = ["E", "I", "F"]
src = ["src"]

[tool.ruff.isort]
order-by-type = false
[tool.ruff.lint]
isort.order-by-type = false
select = ["E", "I", "F"]

[tool.setuptools_scm]
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
smart_open>=6.3.0
smart_open==6.4.0
40 changes: 21 additions & 19 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,16 +322,18 @@ 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 3d69466

Please sign in to comment.