Skip to content
Open
Prev Previous commit
Next Next commit
Fix race condition setup by preserving temp dir and restoring eq test
  • Loading branch information
codervinitjangir committed Mar 5, 2026
commit 981213d5f0d95f592fa5cf1bf7b409377837d4ed
7 changes: 6 additions & 1 deletion tests/test_tasks/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import inspect
import os
import shutil
import tempfile
from pathlib import Path

import numpy as np
Expand All @@ -20,10 +21,11 @@ class OpenMLSplitTest(TestBase):

def setUp(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't change anything here, keep it as it was

Copy link
Copy Markdown
Collaborator

@geetu040 geetu040 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1694 (comment) is still unresolved

super().setUp()
self._temp_dir = tempfile.TemporaryDirectory()
__file__ = inspect.getfile(OpenMLSplitTest)
self.directory = os.path.dirname(__file__)
# This is for dataset
self.arff_filepath = (
source_arff = (
Path(self.directory).parent
/ "files"
/ "org"
Expand All @@ -33,13 +35,16 @@ def setUp(self):
/ "1882"
/ "datasplits.arff"
)
self.arff_filepath = Path(self._temp_dir.name) / "datasplits.arff"
shutil.copy(source_arff, self.arff_filepath)
self.pd_filename = self.arff_filepath.with_suffix(".pkl.py3")

def tearDown(self):
self._temp_dir.cleanup()

def test_eq(self):
split = OpenMLSplit._from_arff_file(self.arff_filepath)
assert split == split # noqa: PLR0124
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can be removed

Suggested change
assert split == split # noqa: PLR0124


split2 = OpenMLSplit._from_arff_file(self.arff_filepath)
split2.name = "a"
Expand Down