Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unit test fix with decorators
  • Loading branch information
Neeratyoy committed Mar 8, 2021
commit b8f906f098dd80b3319609beffc6afff2d184f0f
5 changes: 4 additions & 1 deletion tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,13 +1572,15 @@ def test_format_prediction_task_regression(self):
res = format_prediction(regression, *ignored_input)
self.assertListEqual(res, [0] * 5)

@pytest.mark.flaky() # appears to fail stochastically on test server
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.

Are these errors only with loky? If so, we could use multiprocessing as a default here as we don't want to test for a specific backend in this unit test?

@unittest.skipIf(
LooseVersion(sklearn.__version__) < "0.21",
reason="couldn't perform local tests successfully w/o bloating RAM",
)
@unittest.mock.patch("openml.extensions.sklearn.SklearnExtension._prevent_optimize_n_jobs")
def test__run_task_get_arffcontent_2(self, parallel_mock):
""" Tests if a run executed in parallel is collated correctly. """
set_loky_pickler("pickle")
task = openml.tasks.get_task(7) # Supervised Classification on kr-vs-kp
x, y = task.get_X_and_y(dataset_format="dataframe")
num_instances = x.shape[0]
Expand All @@ -1587,7 +1589,7 @@ def test__run_task_get_arffcontent_2(self, parallel_mock):
n_jobs = 2
backend = "loky" if LooseVersion(joblib.__version__) > "0.11" else "multiprocessing"
with parallel_backend(backend, n_jobs=n_jobs):
res = openml.runs.functions._run_task_get_arffcontent(
res = _proxy_for_run_task_get_arffcontent(
extension=self.extension,
model=clf,
task=task,
Expand Down Expand Up @@ -1622,6 +1624,7 @@ def test__run_task_get_arffcontent_2(self, parallel_mock):
]
scores = [v for k, v in res[2]["predictive_accuracy"][0].items()]
self.assertSequenceEqual(scores, expected_scores, seq_type=list)
set_loky_pickler()

@pytest.mark.flaky() # appears to fail stochastically on test server
@unittest.skipIf(
Expand Down