From 3e4730cb7efff72c0a8c42e848bfc3de5c2e14ff Mon Sep 17 00:00:00 2001
From: PGijsbers
Date: Sat, 4 Mar 2023 11:21:25 +0100
Subject: [PATCH 1/2] Correctly only clean up tests/files/
---
tests/conftest.py | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 89da5fca4..d727bb537 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -24,6 +24,7 @@
import os
import logging
+import pathlib
from typing import List
import pytest
@@ -51,26 +52,20 @@ def worker_id() -> str:
return "master"
-def read_file_list() -> List[str]:
+def read_file_list() -> List[pathlib.Path]:
"""Returns a list of paths to all files that currently exist in 'openml/tests/files/'
- :return: List[str]
+ :return: List[pathlib.Path]
"""
- this_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
- directory = os.path.join(this_dir, "..")
- logger.info("Collecting file lists from: {}".format(directory))
- file_list = []
- for root, _, filenames in os.walk(directory):
- for filename in filenames:
- file_list.append(os.path.join(root, filename))
- return file_list
+ test_files_dir = pathlib.Path(__file__).parent / "files"
+ return [f for f in test_files_dir.rglob("*") if f.is_file()]
-def compare_delete_files(old_list, new_list) -> None:
+def compare_delete_files(old_list: List[pathlib.Path], new_list: List[pathlib.Path]) -> None:
"""Deletes files that are there in the new_list but not in the old_list
- :param old_list: List[str]
- :param new_list: List[str]
+ :param old_list: List[pathlib.Path]
+ :param new_list: List[pathlib.Path]
:return: None
"""
file_list = list(set(new_list) - set(old_list))
From b539d05749d083b918d74f7d152a3c771f1def48 Mon Sep 17 00:00:00 2001
From: PGijsbers
Date: Sat, 4 Mar 2023 11:21:42 +0100
Subject: [PATCH 2/2] Log to console for pytest invocation
---
.github/workflows/test.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 974147ed3..cc38aebb2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -91,8 +91,8 @@ jobs:
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi
# Most of the time, running only the scikit-learn tests is sufficient
if [ ${{ matrix.sklearn-only }} = 'true' ]; then sklearn='-m sklearn'; fi
- echo pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
- pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
+ 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
+ pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1 -o log_cli=true
- name: Run tests on Windows
if: matrix.os == 'windows-latest'
run: | # we need a separate step because of the bash-specific if-statement in the previous one.