Skip to content

Commit 60c9fca

Browse files
committed
Fix all ruff lint errors in inotify test (line length, subprocess path, ternary, string wrapping)
1 parent 16c3786 commit 60c9fca

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

tests/test_pickle_core.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,10 @@ def _params_with_dataframe(*args, **kwargs):
616616
reason="inotify instance limit is only relevant on Linux",
617617
)
618618
@pytest.mark.xfail(
619-
reason="inotify instance limit issue not yet fixed - test will pass when issue is resolved"
619+
reason=(
620+
"inotify instance limit issue not yet fixed - test will pass "
621+
"when issue is resolved"
622+
)
620623
)
621624
def test_inotify_instance_limit_reached():
622625
"""Reproduces the inotify instance exhaustion issue (see Issue #24).
@@ -632,14 +635,16 @@ def test_inotify_instance_limit_reached():
632635
# Try to get the current inotify limit
633636
try:
634637
result = subprocess.run(
635-
["cat", "/proc/sys/fs/inotify/max_user_instances"],
638+
["/bin/cat", "/proc/sys/fs/inotify/max_user_instances"],
636639
capture_output=True,
637640
text=True,
638641
timeout=5,
639642
)
640643
if result.returncode == 0:
641644
current_limit = int(result.stdout.strip())
642-
print(f"Current inotify max_user_instances limit: {current_limit}")
645+
print(
646+
f"Current inotify max_user_instances limit: {current_limit}"
647+
)
643648
else:
644649
current_limit = None
645650
print("Could not determine inotify limit")
@@ -658,13 +663,9 @@ def slow_func(x):
658663
results = queue.Queue()
659664

660665
# Be more aggressive - try to exhaust the limit
661-
if current_limit is not None:
662-
N = min(
663-
current_limit * 4, 4096
664-
) # Try to exceed the limit more aggressively
665-
else:
666-
N = 4096 # Default aggressive value
667-
666+
N = (
667+
min(current_limit * 4, 4096) if current_limit is not None else 4096
668+
) # Try to exceed the limit more aggressively
668669
print(f"Starting {N} threads to test inotify exhaustion")
669670

670671
def call():
@@ -695,10 +696,11 @@ def call():
695696
# the test FAILS (expected failure due to the bug)
696697
if any("inotify instance limit reached" in str(e) for e in errors):
697698
print(
698-
"FAILURE: Hit inotify instance limit - this indicates the bug still exists"
699+
"FAILURE: Hit inotify instance limit - this indicates the bug "
700+
"still exists"
699701
)
700702
raise AssertionError(
701-
f"inotify instance limit reached error occurred. "
703+
"inotify instance limit reached error occurred. "
702704
f"Got {len(errors)} errors with inotify limit issues."
703705
)
704706

@@ -709,6 +711,7 @@ def call():
709711

710712
# If no errors at all, the test PASSES (issue is fixed!)
711713
print(
712-
"SUCCESS: No inotify instance limit errors occurred - the issue appears to be fixed!"
714+
"SUCCESS: No inotify instance limit errors occurred - the issue "
715+
"appears to be fixed!"
713716
)
714717
# No need to return - test passes naturally

0 commit comments

Comments
 (0)