Skip to content

πŸŽ› πŸ”Š A Python library for audio.

Fix test_io_threading to run on Python 3.6.

Peter Sobot1bac563b12f6
diff --git a/tests/test_io_threading.py b/tests/test_io_threading.py
index ad6d9bf..52d968d 100644
--- a/tests/test_io_threading.py
+++ b/tests/test_io_threading.py
@@ -18,7 +18,6 @@
import random
import threading
from concurrent.futures import ThreadPoolExecutor
-from contextlib import nullcontext
from functools import lru_cache
from io import BytesIO
@@ -28,6 +27,11 @@ import pytest
from pedalboard import Resample
from pedalboard.io import AudioFile
+try:
+ from contextlib import nullcontext
+except ImportError:
+ from contextlib import suppress as nullcontext
+
# The number of iterations to run the test for with and
# without a lock around each call to AudioFile's methods:
MAX_ITERATIONS = {"lock": 10, "no lock": 100_000}