conftest.py 572 B

12345678910111213141516171819202122232425
  1. import sys
  2. import pytest
  3. from panda3d import core
  4. from direct.showbase.ShowBase import ShowBase
  5. @pytest.fixture
  6. def base():
  7. base = ShowBase(windowType='none')
  8. yield base
  9. base.destroy()
  10. @pytest.fixture
  11. def tk_toplevel():
  12. tk = pytest.importorskip('tkinter')
  13. if sys.platform == 'darwin' and not core.ConfigVariableBool('want-tk', False):
  14. pytest.skip('"want-tk" must be true to use tkinter with Panda3D on macOS')
  15. try:
  16. root = tk.Toplevel()
  17. except tk.TclError as e:
  18. pytest.skip(str(e))
  19. yield root
  20. root.destroy()