-
-
Notifications
You must be signed in to change notification settings - Fork 270
[MNT] Fix race condition in OpenMLSplit._from_arff_file
#1656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
35c6b2f
ce5aad5
1823407
3889028
5f49723
9d55bfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |
|
|
||
| import inspect | ||
| import os | ||
| import shutil | ||
| import tempfile | ||
| from pathlib import Path | ||
|
|
||
| import numpy as np | ||
|
|
@@ -18,8 +20,7 @@ class OpenMLSplitTest(TestBase): | |
| def setUp(self): | ||
| __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" | ||
|
|
@@ -29,13 +30,15 @@ def setUp(self): | |
| / "1882" | ||
| / "datasplits.arff" | ||
| ) | ||
| self.pd_filename = self.arff_filepath.with_suffix(".pkl.py3") | ||
| # Use temporary directory to avoid conflicts with other tests | ||
| self.temp_dir = Path(tempfile.mkdtemp()) | ||
| self.arff_filepath = self.temp_dir / "datasplits.arff" | ||
| shutil.copy2(source_arff, self.arff_filepath) | ||
|
omkar-334 marked this conversation as resolved.
Outdated
|
||
|
|
||
| def tearDown(self): | ||
| try: | ||
| os.remove(self.pd_filename) | ||
| except (OSError, FileNotFoundError): | ||
| # Replaced bare except. Not sure why these exceptions are acceptable. | ||
| shutil.rmtree(self.temp_dir, ignore_errors=True) | ||
| except OSError: | ||
| pass | ||
|
Comment on lines
42
to
45
|
||
|
|
||
| def test_eq(self): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.