Skip to content

Commit e0d647b

Browse files
committed
extend test, fix bug
1 parent dd94567 commit e0d647b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/apify/storage_clients/_file_system/_key_value_store_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ async def purge(self) -> None:
3030

3131
# First try to find the alternative format of the input file and process it if it exists.
3232
for file_path in self.path_to_kvs.glob('*'):
33-
if (
34-
file_path.name in configuration.input_key_candidates
35-
and file_path.name != configuration.canonical_input_key
36-
):
33+
if file_path.name in configuration.input_key_candidates:
3734
await self._process_input_json(file_path)
3835

3936
async with self._lock:

tests/unit/storage_clients/test_file_system.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import json
55
from typing import TYPE_CHECKING
66

7+
import pytest
8+
79
from crawlee._consts import METADATA_FILENAME
810

911
from apify import Actor, Configuration
@@ -64,16 +66,16 @@ async def test_purge_preserves_input_file_and_metadata() -> None:
6466
assert input_content == '{"test": "input"}'
6567

6668

67-
async def test_pre_existing_input_used_by_actor(tmp_path: Path) -> None:
69+
@pytest.mark.parametrize('input_file_name', ['INPUT', 'INPUT.json'])
70+
async def test_pre_existing_input_used_by_actor(tmp_path: Path, input_file_name: str) -> None:
6871
pre_existing_input = {
6972
'foo': 'bar',
7073
}
7174

72-
configuration = Configuration.get_global_configuration()
7375
# Create pre-existing INPUT.json file
7476
path_to_input = tmp_path / 'key_value_stores' / 'default'
7577
path_to_input.mkdir(parents=True)
76-
(path_to_input / f'{configuration.input_key}.json').write_text(json.dumps(pre_existing_input))
78+
(path_to_input / input_file_name).write_text(json.dumps(pre_existing_input))
7779

7880
async with Actor():
7981
assert pre_existing_input == await Actor.get_input()

0 commit comments

Comments
 (0)