File: f984f1ce58ff9123b0aa2f790c252340897255ab.patch

package info (click to toggle)
pyopengl 3.1.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,024 kB
  • sloc: python: 108,056; sh: 13; makefile: 8
file content (68 lines) | stat: -rw-r--r-- 2,448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From f984f1ce58ff9123b0aa2f790c252340897255ab Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt@techie.net>
Date: Mon, 25 Aug 2025 19:34:57 -0400
Subject: [PATCH] test_mmap_data: use a temporary directory for writing data
Forwarded: https://github.com/mcfletch/pyopengl/pull/161

---
 tests/test_core.py | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/tests/test_core.py b/tests/test_core.py
index 64a81e76..56c9e042 100755
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 from __future__ import print_function
 import pygame, pygame.display
-import logging, time, traceback, unittest, os, pytest
+import logging, time, traceback, unittest, os, pytest, tempfile
 
 logging.basicConfig(level=logging.INFO)
 log = logging.getLogger(__name__)
@@ -171,24 +171,26 @@ def test_mmap_data(self):
             If we had a reasonable lib that dumped raw image data to a shared-mem file
             we might be able to use this for movie display :)
             """
-            fh = open('mmap-test-data.dat', 'wb+')
-            fh.write(_NULL_8_BYTE * (32 * 32 * 3 + 1))
-            fh.flush()
-            fh.close()
-            # using memmap here...
-            data = memmap('mmap-test-data.dat')
-            for i in range(0, 255, 2):
-                glDrawPixels(
-                    32,
-                    32,
-                    GL_RGB,
-                    GL_UNSIGNED_BYTE,
-                    data,
-                )
-                glFlush()
-                pygame.display.flip()
-                data[::2] = i
-                time.sleep(0.001)
+            with tempfile.TemporaryDirectory() as td:
+                fn = os.path.join(td, 'mmap-test-data.dat')
+                fh = open(fn, 'wb+')
+                fh.write(_NULL_8_BYTE * (32 * 32 * 3 + 1))
+                fh.flush()
+                fh.close()
+                # using memmap here...
+                data = memmap(fn)
+                for i in range(0, 255, 2):
+                    glDrawPixels(
+                        32,
+                        32,
+                        GL_RGB,
+                        GL_UNSIGNED_BYTE,
+                        data,
+                    )
+                    glFlush()
+                    pygame.display.flip()
+                    data[::2] = i
+                    time.sleep(0.001)
 
     if array: