Skip to content

Commit

Permalink
Skip multiprocessing using tests when run from py.test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pv committed Jun 28, 2015
1 parent b685890 commit f353c7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
import multiprocessing
import subprocess
import traceback
import pytest

from asv import util


WIN = (os.name == 'nt')


def _multiprocessing_raise_processerror(arg):
try:
raise util.ProcessError(["a"], 1, "aa", "bb")
Expand All @@ -34,6 +38,11 @@ def _multiprocessing_raise_usererror(arg):
def test_parallelfailure():
# Check the workaround for https://bugs.python.org/issue9400 works

if WIN and os.path.basename(sys.argv[0]).lower().startswith('py.test'):
# Multiprocessing in spawn mode can result to problems with py.test
pytest.skip("Multiprocessing spawn mode on Windows not safe to run "
"from py.test runner.")

# The exception class must be pickleable
exc = util.ParallelFailure("test", Exception, "something")
exc2 = pickle.loads(pickle.dumps(exc))
Expand Down
9 changes: 9 additions & 0 deletions test/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from . import tools


WIN = (os.name == 'nt')


dummy_values = [
(None, None),
(1, 1),
Expand Down Expand Up @@ -140,6 +143,12 @@ def test_continuous(capfd, basic_conf):
def test_find(capfd, basic_conf):
tmpdir, local, conf, machine_file = basic_conf

if WIN and os.path.basename(sys.argv[0]).lower().startswith('py.test'):
# Multiprocessing in spawn mode can result to problems with py.test
# Find.run calls Setup.run in parallel mode by default
pytest.skip("Multiprocessing spawn mode on Windows not safe to run "
"from py.test runner.")

# Test find at least runs
Find.run(conf, "master~5..master", "params_examples.track_find_test",
_machine_file=machine_file)
Expand Down

0 comments on commit f353c7b

Please sign in to comment.