Skip to content

Commit

Permalink
skip tests on macos because multiprocess default switch to spawn
Browse files Browse the repository at this point in the history
…since Python 3.8 (#3705)

* add docs for line magic

Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>

* Skip test in MacOS

Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>

* revert changes

Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>

* lint

Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>

---------

Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>
  • Loading branch information
noklam authored Mar 13, 2024
1 parent 1f2adf1 commit d552f9d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/framework/session/test_session_extension_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import multiprocessing
import re
import sys
import time
from typing import Any

Expand Down Expand Up @@ -30,8 +30,11 @@
assert_exceptions_equal,
)

SKIP_ON_WINDOWS = pytest.mark.skipif(
sys.platform.startswith("win"), reason="Due to bug in parallel runner"
# Window and MacOS(Python>3.7) default with `spawn` process which reload modules
# and cause test fails
SKIP_ON_WINDOWS_AND_MACOS = pytest.mark.skipif(
multiprocessing.get_start_method() == "spawn",
reason="Due to bug in parallel runner",
)

logger = logging.getLogger("tests.framework.session.conftest")
Expand Down Expand Up @@ -233,7 +236,7 @@ def test_before_and_after_node_run_hooks_sequential_runner(
# sanity check a couple of important parameters
assert call_record.outputs["planes"].to_dict() == dummy_dataframe.to_dict()

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
@pytest.mark.usefixtures("mock_broken_pipelines")
def test_on_node_error_hook_parallel_runner(self, mock_session, logs_listener):
with pytest.raises(ValueError, match="broken"):
Expand All @@ -254,7 +257,7 @@ def test_on_node_error_hook_parallel_runner(self, mock_session, logs_listener):
expected_error = ValueError("broken")
assert_exceptions_equal(call_record.error, expected_error)

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
@pytest.mark.usefixtures("mock_pipelines")
def test_before_and_after_node_run_hooks_parallel_runner(
self, mock_session, logs_listener, dummy_dataframe
Expand Down Expand Up @@ -322,7 +325,7 @@ def test_before_and_after_dataset_loaded_hooks_sequential_runner(
assert call_record.dataset_name == "cars"
pd.testing.assert_frame_equal(call_record.data, dummy_dataframe)

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
@pytest.mark.usefixtures("mock_settings")
def test_before_and_after_dataset_loaded_hooks_parallel_runner(
self, mock_session, logs_listener, dummy_dataframe
Expand Down Expand Up @@ -388,7 +391,7 @@ def test_before_and_after_dataset_saved_hooks_sequential_runner(
assert call_record.dataset_name == "planes"
assert call_record.data.to_dict() == dummy_dataframe.to_dict()

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
def test_before_and_after_dataset_saved_hooks_parallel_runner(
self, mock_session, logs_listener, dummy_dataframe
):
Expand Down Expand Up @@ -475,7 +478,7 @@ def test_correct_input_update(
assert isinstance(result["planes"], MockDatasetReplacement)
assert isinstance(result["ships"], pd.DataFrame)

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
def test_correct_input_update_parallel(
self,
mock_session_with_before_node_run_hooks,
Expand Down Expand Up @@ -505,7 +508,7 @@ def test_broken_input_update(
with pytest.raises(TypeError, match=re.escape(pattern)):
mock_session_with_broken_before_node_run_hooks.run()

@SKIP_ON_WINDOWS
@SKIP_ON_WINDOWS_AND_MACOS
def test_broken_input_update_parallel(
self, mock_session_with_broken_before_node_run_hooks, dummy_dataframe
):
Expand Down

0 comments on commit d552f9d

Please sign in to comment.