Skip to content

Commit 5164c13

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3fc8000 commit 5164c13

7 files changed

Lines changed: 44 additions & 33 deletions

File tree

scripts/test-local.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ check_docker() {
206206
echo ""
207207
echo "After starting Docker, wait a few seconds and try running this script again."
208208
echo ""
209-
209+
210210
# Show the actual docker error for debugging
211211
echo "Technical details:"
212212
docker ps 2>&1 | sed 's/^/ /'
213213
echo ""
214214
exit 1
215215
fi
216-
216+
217217
print_message $GREEN "✓ Docker is installed and running"
218218
}
219219

@@ -488,13 +488,13 @@ main() {
488488
# Run pytest
489489
# Build pytest command
490490
PYTEST_CMD="pytest"
491-
491+
492492
# Add test files if specified
493493
if [ -n "$TEST_FILES" ]; then
494494
PYTEST_CMD="$PYTEST_CMD $TEST_FILES"
495495
print_message $BLUE "Test files specified: $TEST_FILES"
496496
fi
497-
497+
498498
# Add markers if needed (only if no specific test files were given)
499499
if [ -z "$TEST_FILES" ]; then
500500
# Check if we selected all cores - if so, run all tests without marker filtering
@@ -510,20 +510,20 @@ main() {
510510
all_cores="memory mongo pickle redis sql"
511511
selected_sorted=$(echo "$SELECTED_CORES" | tr ' ' '\n' | sort | tr '\n' ' ' | xargs)
512512
all_sorted=$(echo "$all_cores" | tr ' ' '\n' | sort | tr '\n' ' ' | xargs)
513-
513+
514514
if [ "$selected_sorted" != "$all_sorted" ]; then
515515
PYTEST_CMD="$PYTEST_CMD -m \"$pytest_markers\""
516516
fi
517517
fi
518-
518+
519519
# Add verbose flag if needed
520520
if [ "$VERBOSE" = true ]; then
521521
PYTEST_CMD="$PYTEST_CMD -v"
522522
fi
523-
523+
524524
# Add coverage options
525525
PYTEST_CMD="$PYTEST_CMD --cov=cachier --cov-report=$COVERAGE_REPORT"
526-
526+
527527
# Print and run the command
528528
print_message $BLUE "Running: $PYTEST_CMD"
529529
eval $PYTEST_CMD

tests/test_config.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
def test_set_default_params_deprecated():
1111
"""Test that set_default_params shows deprecation warning."""
1212
# Test lines 103-111: deprecation warning
13-
with pytest.warns(DeprecationWarning, match="set_default_params.*deprecated.*set_global_params"):
13+
with pytest.warns(
14+
DeprecationWarning,
15+
match="set_default_params.*deprecated.*set_global_params",
16+
):
1417
set_default_params(stale_after=60)
1518

1619

1720
def test_get_default_params_deprecated():
1821
"""Test that get_default_params shows deprecation warning."""
1922
# Test lines 143-151: deprecation warning
20-
with pytest.warns(DeprecationWarning, match="get_default_params.*deprecated.*get_global_params"):
23+
with pytest.warns(
24+
DeprecationWarning,
25+
match="get_default_params.*deprecated.*get_global_params",
26+
):
2127
params = get_default_params()
22-
assert params is not None
28+
assert params is not None

tests/test_main.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,40 @@ def test_cli_group():
1717
def test_set_max_workers_command():
1818
"""Test the set_max_workers command."""
1919
runner = CliRunner()
20-
20+
2121
# First check if the command exists in the CLI
2222
result = runner.invoke(cli, ["--help"])
2323
assert result.exit_code == 0
24-
24+
2525
# The command decorator syntax in __main__.py is incorrect
2626
# It should be @cli.command() or @cli.command("command-name")
2727
# Currently it's using the description as the command name
2828
# So the command is registered with a long name
29-
29+
3030
# Test with the actual registered command name
31-
result = runner.invoke(cli, ["Limits the number of worker threads used by cachier.", "4"])
31+
result = runner.invoke(
32+
cli, ["Limits the number of worker threads used by cachier.", "4"]
33+
)
3234
assert result.exit_code == 0
33-
35+
3436
# Test with invalid input (non-integer)
35-
result = runner.invoke(cli, ["Limits the number of worker threads used by cachier.", "invalid"])
37+
result = runner.invoke(
38+
cli,
39+
["Limits the number of worker threads used by cachier.", "invalid"],
40+
)
3641
assert result.exit_code != 0
37-
42+
3843
# Test without argument
39-
result = runner.invoke(cli, ["Limits the number of worker threads used by cachier."])
44+
result = runner.invoke(
45+
cli, ["Limits the number of worker threads used by cachier."]
46+
)
4047
assert result.exit_code != 0
4148

4249

4350
def test_set_max_workers_function():
4451
"""Test the set_max_workers function directly."""
4552
# This tests the function import and ensures it's callable
4653
# The actual functionality is tested in core tests
47-
54+
4855
# Verify the function is callable
49-
assert callable(set_max_workers)
56+
assert callable(set_max_workers)

tests/test_memory_core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import hashlib
44
import queue
55
import threading
6-
from datetime import timedelta
76
from datetime import datetime, timedelta
87
from random import random
98
from time import sleep, time

tests/test_pickle_core.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
# realpath,
1212
# dirname
1313
# )
14+
import hashlib
1415
import os
15-
import sys
16-
import time
1716
import pickle
18-
import hashlib
17+
import sys
1918
import tempfile
2019
import threading
21-
from pathlib import Path
20+
import time
2221
from datetime import datetime, timedelta
22+
from pathlib import Path
2323
from random import random
2424
from time import sleep, time
2525
from unittest.mock import MagicMock, Mock, patch
@@ -35,8 +35,7 @@
3535
import pandas as pd
3636

3737
from cachier import cachier
38-
from cachier.config import _global_params
39-
from cachier.config import CacheEntry
38+
from cachier.config import CacheEntry, _global_params
4039
from cachier.cores.pickle import _PickleCore
4140

4241

tests/test_redis_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import hashlib
44
import queue
55
import threading
6-
from random import random
7-
from time import sleep
86
import warnings
97
from datetime import datetime, timedelta
8+
from random import random
9+
from time import sleep
1010
from unittest.mock import MagicMock, Mock, patch
1111

1212
import pandas as pd

tests/test_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def test_parse_bytes_invalid_format():
1818
# Test line 15: ValueError for invalid format
1919
with pytest.raises(ValueError, match="Invalid size value: invalid"):
2020
parse_bytes("invalid")
21-
21+
2222
with pytest.raises(ValueError, match="Invalid size value: 123XB"):
2323
parse_bytes("123XB")
24-
24+
2525
with pytest.raises(ValueError, match="Invalid size value: abc123"):
26-
parse_bytes("abc123")
26+
parse_bytes("abc123")

0 commit comments

Comments
 (0)