Skip to content

Commit 24cbc5e

Browse files
authored
Fix coverage (#1226)
* Correctly only clean up tests/files/ * Log to console for pytest invocation
1 parent c177d39 commit 24cbc5e

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ jobs:
9191
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi
9292
# Most of the time, running only the scikit-learn tests is sufficient
9393
if [ ${{ matrix.sklearn-only }} = 'true' ]; then sklearn='-m sklearn'; fi
94-
echo pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
95-
pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
94+
echo pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1 -o log_cli=true
95+
pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1 -o log_cli=true
9696
- name: Run tests on Windows
9797
if: matrix.os == 'windows-latest'
9898
run: | # we need a separate step because of the bash-specific if-statement in the previous one.

tests/conftest.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import os
2626
import logging
27+
import pathlib
2728
from typing import List
2829
import pytest
2930

@@ -51,26 +52,20 @@ def worker_id() -> str:
5152
return "master"
5253

5354

54-
def read_file_list() -> List[str]:
55+
def read_file_list() -> List[pathlib.Path]:
5556
"""Returns a list of paths to all files that currently exist in 'openml/tests/files/'
5657
57-
:return: List[str]
58+
:return: List[pathlib.Path]
5859
"""
59-
this_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
60-
directory = os.path.join(this_dir, "..")
61-
logger.info("Collecting file lists from: {}".format(directory))
62-
file_list = []
63-
for root, _, filenames in os.walk(directory):
64-
for filename in filenames:
65-
file_list.append(os.path.join(root, filename))
66-
return file_list
60+
test_files_dir = pathlib.Path(__file__).parent / "files"
61+
return [f for f in test_files_dir.rglob("*") if f.is_file()]
6762

6863

69-
def compare_delete_files(old_list, new_list) -> None:
64+
def compare_delete_files(old_list: List[pathlib.Path], new_list: List[pathlib.Path]) -> None:
7065
"""Deletes files that are there in the new_list but not in the old_list
7166
72-
:param old_list: List[str]
73-
:param new_list: List[str]
67+
:param old_list: List[pathlib.Path]
68+
:param new_list: List[pathlib.Path]
7469
:return: None
7570
"""
7671
file_list = list(set(new_list) - set(old_list))

0 commit comments

Comments
 (0)