From 839e6727487549170ebec92cd7f68482d4867f47 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 9 Jan 2021 03:19:25 +0000 Subject: [PATCH] tests: fix py2.7 --- tests/tests_tqdm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/tests_tqdm.py b/tests/tests_tqdm.py index 8defaf98..3728997b 100644 --- a/tests/tests_tqdm.py +++ b/tests/tests_tqdm.py @@ -800,12 +800,13 @@ def test_smoothed_dynamic_min_iters_with_min_interval(): @mark.slow def test_rlock_creation(): """Test that importing tqdm does not create multiprocessing objects.""" - importorskip('multiprocessing') - from multiprocessing import get_context + mp = importorskip('multiprocessing') + if not hasattr(mp, 'get_context'): + skip("missing multiprocessing.get_context") # Use 'spawn' instead of 'fork' so that the process does not inherit any # globals that have been constructed by running other tests - ctx = get_context('spawn') + ctx = mp.get_context('spawn') with ctx.Pool(1) as pool: # The pool will propagate the error if the target method fails pool.apply(_rlock_creation_target)