@@ -396,11 +396,11 @@ def test_cwd_in_sys_path():
396396
397397
398398@flaky (max_runs = 3 )
399- @pytest .mark .skipif (not ( os . name == 'nt' and PY3 ) ,
400- reason = "Only meant for Windows and Python 3" )
399+ @pytest .mark .skipif (not PY3 ,
400+ reason = "Only meant for Python 3" )
401401def test_multiprocessing (tmpdir ):
402402 """
403- Test that multiprocessing works on Windows and Python 3.
403+ Test that multiprocessing works on Python 3.
404404 """
405405 # Command to start the kernel
406406 cmd = "from spyder_kernels.console import start; start.main()"
@@ -435,6 +435,48 @@ def f(x):
435435 assert content ['found' ]
436436
437437
438+ @flaky (max_runs = 3 )
439+ @pytest .mark .skipif (not PY3 ,
440+ reason = "Only meant for Python 3" )
441+ def test_dask_multiprocessing (tmpdir ):
442+ """
443+ Test that dask multiprocessing works on Python 3.
444+ """
445+ # Command to start the kernel
446+ cmd = "from spyder_kernels.console import start; start.main()"
447+
448+ with setup_kernel (cmd ) as client :
449+ # Remove all variables
450+ client .execute ("%reset -f" )
451+ client .get_shell_msg (block = True , timeout = TIMEOUT )
452+
453+ # Write multiprocessing code to a file
454+ # Runs two times to verify that in the second case it doesn't break
455+ code = """
456+ from dask.distributed import Client
457+
458+ if __name__=='__main__':
459+ client = Client()
460+ client.close()
461+ x = 'hello'
462+ """
463+ p = tmpdir .join ("mp-test.py" )
464+ p .write (code )
465+
466+ # Run code two times
467+ client .execute ("runfile(r'{}')" .format (to_text_string (p )))
468+ client .get_shell_msg (block = True , timeout = TIMEOUT )
469+
470+ client .execute ("runfile(r'{}')" .format (to_text_string (p )))
471+ client .get_shell_msg (block = True , timeout = TIMEOUT )
472+
473+ # Verify that the `x` variable is defined
474+ client .inspect ('x' )
475+ msg = client .get_shell_msg (block = True , timeout = TIMEOUT )
476+ content = msg ['content' ]
477+ assert content ['found' ]
478+
479+
438480@flaky (max_runs = 3 )
439481def test_runfile (tmpdir ):
440482 """
0 commit comments