From 69a9808eab55b3f6951faec8334249e344301efb Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 12 Sep 2023 11:47:19 +0200 Subject: [PATCH] Check CI pypy (#95) * arbitrary change * Found the hanging test, try something * another change * fail earlier * xfail test on pypy --- .github/workflows/ci.yml | 2 +- tests/test_special.py | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d06ef..df66cc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false matrix: include: - # Py versions + # Python versions - name: Linux py37 os: ubuntu-latest pyversion: '3.7' diff --git a/tests/test_special.py b/tests/test_special.py index 8c88df8..afc70bc 100644 --- a/tests/test_special.py +++ b/tests/test_special.py @@ -2,30 +2,39 @@ """ import gc +import sys import queue import threading from testutils import ensure_test_files, test_file1 +import pytest import imageio_ffmpeg +IS_PYPY = "__pypy__" in sys.builtin_module_names + + def setup_module(): ensure_test_files() +def make_iterator(q, n): + for i in range(n): + gen = imageio_ffmpeg.read_frames(test_file1) + gen.__next__() # meta data + q.put(gen.__next__()) # first frame + + def test_threading(): # See issue #20 + if IS_PYPY: + pytest.xfail("These threads hang on pypy for some reason.") + num_threads = 16 num_frames = 5 - def make_iterator(q, n): - for i in range(n): - gen = imageio_ffmpeg.read_frames(test_file1) - gen.__next__() # meta data - q.put(gen.__next__()) # first frame - q = queue.Queue() threads = [] for i in range(num_threads): @@ -36,10 +45,10 @@ def make_iterator(q, n): for i in range(num_threads * num_frames): print(i, end=" ") - q.get() gc.collect() # this seems to help invoke the segfault earlier + q.get(timeout=20) if __name__ == "__main__": - # setup_module() + setup_module() test_threading()