Skip to content

Commit

Permalink
tests: mock window libraries before doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
einarf committed Feb 2, 2020
1 parent 31f92ea commit fae1ee9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,35 @@
import sys
import types
import unittest
from unittest.mock import MagicMock

from moderngl_window.utils import module_loading

# Mock modules
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()


MOCK_MODULES = [
'glfw',
'sdl2',
'sdl2.ext',
'sdl2.video',
'pyglet',
'pyglet.window',
'PyQt5',
'PyQt5.QtCore',
'QtCore',
'QtOpenGL',
'QtWidgets',
'PySide2',
'PySide2.QtCore',
]

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


class TestCase(unittest.TestCase):
"""
Expand Down

0 comments on commit fae1ee9

Please sign in to comment.