conftest.py 736 B

123456789101112131415161718192021222324252627
  1. import os
  2. import sys
  3. from pathlib import Path
  4. import pytest
  5. CWD = Path(__file__).parent
  6. ROOT = CWD.parent.parent
  7. # append directory with build files to sys.path to import them
  8. sys.path.append(str(ROOT))
  9. @pytest.fixture
  10. def shader_files(request):
  11. shader_path = request.param
  12. res = {
  13. "path_input": str(CWD / "fixtures" / f"{shader_path}.glsl"),
  14. "path_output": str(CWD / "fixtures" / f"{shader_path}.glsl.gen.h"),
  15. "path_expected_full": str(CWD / "fixtures" / f"{shader_path}_expected_full.glsl"),
  16. "path_expected_parts": str(CWD / "fixtures" / f"{shader_path}_expected_parts.json"),
  17. }
  18. yield res
  19. if not os.getenv("PYTEST_KEEP_GENERATED_FILES"):
  20. os.remove(res["path_output"])