Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fixed segmentation faults from doctests under Python 3.10 (#2994)

Benjamin Hacklf65991c2897e
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cf8501a6a..ea5a5ab20 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -201,7 +201,7 @@ jobs:
- name: Run module doctests
run: |
- poetry run python -m pytest -v --cov-append --doctest-modules manim
+ poetry run python -m pytest -v --cov-append --ignore-glob="*opengl*" --doctest-modules manim
- name: Run doctests in rst files
run: |
diff --git a/conftest.py b/conftest.py
index 688105058..da37e19ba 100644
--- a/conftest.py
+++ b/conftest.py
@@ -5,6 +5,12 @@
from __future__ import annotations
+try:
+ # https://github.com/moderngl/moderngl/issues/517
+ import readline # required to prevent a segfault on Python 3.10
+except ModuleNotFoundError: # windows
+ pass
+
import moderngl
# If it is running Doctest the current directory
@@ -30,10 +36,12 @@ def temp_media_dir(tmpdir, monkeypatch, request):
def pytest_report_header(config):
ctx = moderngl.create_standalone_context()
+ info = ctx.info
+ ctx.release()
return (
- "\nOpenGL Information",
+ "\nOpenGL information",
"------------------",
- f"vendor: {ctx.info['GL_VENDOR'].strip()}",
- f"renderer: {ctx.info['GL_RENDERER'].strip()}",
- f"version: {ctx.info['GL_VERSION'].strip()}\n",
+ f"vendor: {info['GL_VENDOR'].strip()}",
+ f"renderer: {info['GL_RENDERER'].strip()}",
+ f"version: {info['GL_VERSION'].strip()}\n",
)