Skip to content

Commit b496007

Browse files
authored
Merge pull request #86 from azmeuk/precommit
pre-commit update
2 parents cf905e4 + 7d6e4da commit b496007

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
---
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: 'v0.4.3'
4+
rev: 'v0.8.5'
55
hooks:
66
- id: ruff
77
args: [--fix, --exit-non-zero-on-fix]
88
- id: ruff-format
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.6.0
10+
rev: v5.0.0
1111
hooks:
1212
- id: fix-byte-order-marker
1313
- id: trailing-whitespace
1414
- id: end-of-file-fixer
1515
- id: check-toml
16-
- repo: https://github.com/PyCQA/docformatter
17-
rev: v1.7.5
18-
hooks:
19-
- id: docformatter

libfaketime/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def get_reload_information():
8686

8787
def main(): # pragma: nocover
8888
"""Print the necessary environment to stdout."""
89-
9089
_, _env_additions = get_reload_information()
9190
for key, value in _env_additions.items():
9291
print(f'export {key}="{value}"')
@@ -111,12 +110,12 @@ def reexec_if_needed(remove_vars=True, quiet=False):
111110

112111

113112
def begin_callback(instance):
114-
"""Called just before faking the time."""
113+
"""Execute custom code just before faking the time."""
115114
pass
116115

117116

118117
def end_callback(instance):
119-
"""Called just after finished faking the time."""
118+
"""Execute custom code after finished faking the time."""
120119
pass
121120

122121

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
[tool.ruff.lint]
22
select = [
3+
"D", # pydocstyle
34
"E", # pycodestyle
45
"F", # pyflakes
56
"I", # isort
67
"UP", # pyupgrade
78
]
9+
ignore = [
10+
"D100", # public module
11+
"D101", # public class
12+
"D102", # public method
13+
"D103", # public function
14+
"D104", # public package
15+
"D105", # magic method
16+
"D106", # nested class
17+
"D107", # public init
18+
"D203", # no-blank-line-before-class
19+
"D213", # multi-line-summary-second-line
20+
]
821

922
[tool.ruff.lint.isort]
1023
force-single-line = true
1124

12-
[too.ruff.format]
25+
[tool.ruff.format]
1326
docstring-code-format = true

test/test_faketime.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ def test_timestmap_file(self, tmpdir):
110110
class TestUUID1Deadlock:
111111
@fake_time(datetime.datetime.now())
112112
def test_uuid1_does_not_deadlock(self):
113-
"""This test will deadlock if we fail to patch a system level uuid
114-
library."""
113+
"""Check the compatibility of uuid1.
114+
115+
This test will deadlock if we fail to patch a system level uuid library.
116+
"""
115117
for i in range(100):
116118
uuid.uuid1()
117119

test/test_tz.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010

1111
def test_timezone_is_restored_after_context_manager_usage():
12-
"""https://github.com/simon-weber/python-libfaketime/issues/43"""
12+
"""Check that timezones are restored when faketime context manager are closed.
13+
14+
https://github.com/simon-weber/python-libfaketime/issues/43
15+
"""
1316
now1 = datetime.datetime.now()
1417
utcnow1 = datetime.datetime.utcnow()
1518

@@ -37,8 +40,7 @@ def test_tzinfo_is_normalized():
3740

3841

3942
def test_block_setting_of_conflicting_tz_info():
40-
"""Cannot pass in tz_offset when the timestamp already carries a
41-
timezone."""
43+
"""Cannot pass in tz_offset when the timestamp already carries a timezone."""
4244
with pytest.raises(Exception) as exc_info:
4345
timezone_to_test_with = timezone("America/Havana")
4446
time_to_freeze = timezone_to_test_with.localize(
@@ -55,7 +57,10 @@ def test_block_setting_of_conflicting_tz_info():
5557

5658
@pytest.mark.parametrize("offset", range(-2, 3))
5759
def test_generated_tz_is_valid(offset):
58-
"""https://github.com/simon-weber/python-libfaketime/issues/46"""
60+
"""Check that generated timezones are valid.
61+
62+
https://github.com/simon-weber/python-libfaketime/issues/46
63+
"""
5964
now = datetime.datetime.now()
6065

6166
with fake_time(now, tz_offset=offset):

0 commit comments

Comments
 (0)