File: update-examples-directory-in-tests

package info (click to toggle)
python-guizero 1.6.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,872 kB
  • sloc: python: 7,160; makefile: 34; sh: 17
file content (205 lines) | stat: -rw-r--r-- 6,048 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
Description: Update paths to assets copied from examples/ directory
 During tests the assets required for tests are copied into tests/
 and paths updated to allow the tests to be run from the build_dir root
Author: Nick Morrott <nickm@debian.org>
Forwarded: not-needed
Last-Update: 2025-02-02
---
--- a/tests/test_picture.py
+++ b/tests/test_picture.py
@@ -31,13 +31,13 @@
     a = App(layout="grid")
     p = Picture(
         a,
-        image="../examples/guizero.gif",
+        image="tests/guizero.gif",
         grid=[0, 1],
         align="top",
         width=10,
         height=11,
     )
-    assert p.image == "../examples/guizero.gif"
+    assert p.image == "tests/guizero.gif"
     assert p._image.tk_image is not None
     assert p.grid[0] == 0
     assert p.grid[1] == 1
@@ -52,8 +52,8 @@
     p = Picture(a)
 
     assert p.image == None
-    p.image = "../examples/guizero.gif"
-    assert p.image == "../examples/guizero.gif"
+    p.image = "tests/guizero.gif"
+    assert p.image == "tests/guizero.gif"
     assert p._image.tk_image is not None
     p.width = 100
     assert p.width == 100
@@ -66,9 +66,9 @@
 @pytest.mark.skipif(system_config.PIL_available == False, reason="PIL not available")
 def test_jpg():
     a = App()
-    p = Picture(a, image="../examples/guizero.jpg")
+    p = Picture(a, image="tests/guizero.jpg")
 
-    assert p.image == "../examples/guizero.jpg"
+    assert p.image == "tests/guizero.jpg"
     assert p._image.tk_image is not None
     assert p._image.pil_image is not None
 
@@ -78,7 +78,7 @@
 @pytest.mark.skipif(system_config.PIL_available == False, reason="PIL not available")
 def test_animated_picture():
     a = App()
-    p = Picture(a, image="../examples/guizero_flash.gif")
+    p = Picture(a, image="tests/guizero_flash.gif")
 
     assert p._image.tk_image is not None
     assert p._image.pil_image is not None
@@ -92,7 +92,7 @@
     from tkinter import PhotoImage
 
     a = App()
-    photo_image = PhotoImage(file="../examples/guizero.gif")
+    photo_image = PhotoImage(file="tests/guizero.gif")
     p = Picture(a, image=photo_image)
     assert p.image == photo_image
     assert p._image.tk_image is not None
@@ -104,7 +104,7 @@
     from PIL import Image
 
     a = App()
-    pil_image = Image.open("../examples/guizero.gif")
+    pil_image = Image.open("tests/guizero.gif")
     p = Picture(a, image=pil_image)
     assert p.image == pil_image
     assert p._image.tk_image is not None
--- a/tests/test_pushbutton.py
+++ b/tests/test_pushbutton.py
@@ -134,8 +134,8 @@
 
 def test_picture_gif():
     a = App()
-    b = PushButton(a, image="../examples/guizero.gif")
-    assert b.image == "../examples/guizero.gif"
+    b = PushButton(a, image="tests/guizero.gif")
+    assert b.image == "tests/guizero.gif"
     assert b._image.tk_image is not None
     a.destroy()
 
@@ -143,8 +143,8 @@
                     reason="PIL not available")
 def test_picture_jpg():
     a = App()
-    b = PushButton(a, image="../examples/guizero.jpg")
-    assert b.image == "../examples/guizero.jpg"
+    b = PushButton(a, image="tests/guizero.jpg")
+    assert b.image == "tests/guizero.jpg"
     assert b._image.tk_image is not None
     assert b._image.pil_image is not None
     a.destroy()
@@ -153,8 +153,8 @@
                     reason="PIL not available")
 def test_animated_picture():
     a = App()
-    b = PushButton(a, image="../examples/guizero_flash.gif")
-    assert b.image == "../examples/guizero_flash.gif"
+    b = PushButton(a, image="tests/guizero_flash.gif")
+    assert b.image == "tests/guizero_flash.gif"
     assert b._image.tk_image is not None
     assert b._image.pil_image is not None
     assert b._image.animation
@@ -165,7 +165,7 @@
     from tkinter import PhotoImage
 
     a = App()
-    photo_image = PhotoImage(file="../examples/guizero.gif")
+    photo_image = PhotoImage(file="tests/guizero.gif")
     b = PushButton(a, image=photo_image)
     assert b.image == photo_image
     assert b._image.tk_image is not None
@@ -177,7 +177,7 @@
     from PIL import Image
 
     a = App()
-    pil_image = Image.open("../examples/guizero.gif")
+    pil_image = Image.open("tests/guizero.gif")
     b = PushButton(a, image=pil_image)
     assert b.image == pil_image
     assert b._image.tk_image is not None
--- a/tests/test_drawing.py
+++ b/tests/test_drawing.py
@@ -83,7 +83,7 @@
 
 def test_line():
     a = App()
-    d = Drawing(a)    
+    d = Drawing(a)
     id = d.line(1,2,3,4)
     assert id > 0
     a.destroy()
@@ -119,7 +119,7 @@
 def test_image():
     a = App()
     d = Drawing(a)
-    id = d.image(1,2,"../examples/guizero.gif")
+    id = d.image(1,2,"tests/guizero.gif")
     assert id > 0
     a.destroy()
 
--- a/tests/test_app.py
+++ b/tests/test_app.py
@@ -75,7 +75,7 @@
     a.destroy()
 
 def test_when_resized():
-    
+
     a = App()
 
     resize_event = Event()
@@ -92,7 +92,7 @@
     a.resize(501, 502)
     assert resize_event.wait(1)
     resize_event.clear()
-    
+
     a.when_resized = callback_params
     a.resize(503, 504)
     assert resize_event.wait(1)
@@ -126,12 +126,12 @@
 
 def test_icon():
     a = App()
-    icon_test(a, "../examples/guizero.gif")
+    icon_test(a, "tests/guizero.gif")
     a.destroy()
 
 @pytest.mark.skipif(system_config.PIL_available == False,
                     reason="PIL not available")
 def test_icon_jpg():
     a = App()
-    icon_test(a, "../examples/guizero.jpg")
-    a.destroy()
\ No newline at end of file
+    icon_test(a, "tests/guizero.jpg")
+    a.destroy()
--- a/tests/test_window.py
+++ b/tests/test_window.py
@@ -111,7 +111,7 @@
 def test_icon():
     a = App()
     w = Window(a)
-    icon_test(w, "../examples/guizero.gif")
+    icon_test(w, "tests/guizero.gif")
     a.destroy()
 
 @pytest.mark.skipif(system_config.PIL_available == False,
@@ -119,5 +119,5 @@
 def test_icon_jpg():
     a = App()
     w = Window(a)
-    icon_test(w, "../examples/guizero.jpg")
-    a.destroy()
\ No newline at end of file
+    icon_test(w, "tests/guizero.jpg")
+    a.destroy()