Skip to content

Commit a7e04d3

Browse files
committed
add iterdir test
1 parent f2f6a8c commit a7e04d3

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
cancel-in-progress: true
206206
env:
207207
PANDAS_CI: 1
208-
PYTEST_TARGET: pandas
208+
PYTEST_TARGET: pandas/tests/io/test_common.py
209209
PATTERN: "not slow and not db and not network and not single_cpu"
210210
PYTEST_WORKERS: 'auto'
211211

pandas/tests/io/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ def compression_ext(request):
225225
return request.param[0]
226226

227227

228+
@pytest.fixture
229+
def local_csv_file(tmp_path):
230+
"""
231+
Fixture to create a dummy CSV file for testing.
232+
"""
233+
file_path = tmp_path / "dummy.csv"
234+
with open(file_path, "w") as f:
235+
f.write("A,B,C\n1,2,3\n4,5,6\n")
236+
return file_path
237+
238+
228239
@pytest.fixture
229240
def local_csv_directory(tmp_path):
230241
"""

pandas/tests/io/test_common.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,13 @@ def test_iterdir_local(local_csv_directory):
707707
assert file.suffix == ".csv"
708708

709709

710-
def test_iterdir_local_passthrough(local_csv_directory): ...
710+
def test_iterdir_local_passthrough(local_csv_file):
711+
result = icom.iterdir(local_csv_file)
712+
assert isinstance(result, list)
713+
assert len(result) == 1
714+
file = result[0]
715+
assert file.exists()
716+
assert file.is_file()
711717

712718

713719
def test_remote_csv_directory(remote_csv_directory):

0 commit comments

Comments
 (0)