Skip to content

Commit

Permalink
Check CI pypy (#95)
Browse files Browse the repository at this point in the history
* arbitrary change

* Found the hanging test, try something

* another change

* fail earlier

* xfail test on pypy
  • Loading branch information
almarklein authored Sep 12, 2023
1 parent b315ef2 commit 69a9808
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
include:
# Py versions
# Python versions
- name: Linux py37
os: ubuntu-latest
pyversion: '3.7'
Expand Down
25 changes: 17 additions & 8 deletions tests/test_special.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()

0 comments on commit 69a9808

Please sign in to comment.