8000 Unskip some tests, delete others (#1742) · pyscript/pyscript@b9a1227 · GitHub
[go: up one dir, main page]

Skip to content

Commit b9a1227

Browse files
authored
Unskip some tests, delete others (#1742)
Clean up a bit the testsuite and integration tests. Highlights: - Some of the @Skipped tests just worked -- I unskipped them - some worked after some small tweak to adapt to the new pyscript next - some are still skipped, but I tweaked the skip message to be more precise and descriptive - Moreover, I killed/removed the ones which no longer make sense in the context of pyscript next; in particular, I removed all the ones which tested Element (which is now gone) and the one which tested py-config features which are no longer needed (e.g., multiple interpreters). The testsuite passes locally.
1 parent 801c639 commit b9a1227

File tree

9 files changed

+40
-558
lines changed

9 files changed

+40
-558
lines changed

pyscript.core/tests/integration/support.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def filter_page_content(lines, exclude=None):
126126

127127

128128
@pytest.mark.usefixtures("init")
129-
@with_execution_thread("main", "worker")
129+
@with_execution_thread("main") # , "worker") # XXX re-enable workers eventually
130130
class PyScriptTest:
131131
"""
132132
Base class to write PyScript integration tests, based on playwright.
@@ -179,6 +179,7 @@ def init(self, request, tmpdir, logger, page, execution_thread):
179179
# create a symlink to BUILD inside tmpdir
180180
tmpdir.join("build").mksymlinkto(BUILD)
181181
self.tmpdir.chdir()
182+
self.tmpdir.join('favicon.ico').write("")
182183
self.logger = logger
183184
self.execution_thread = execution_thread
184185
self.dev_server = None

pyscript.core/tests/integration/test_01_basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def test_escaping_of_angle_brackets(self):
167167
"C true false",
168168
"D <div></div>"]
169169

170-
@pytest.mark.skip(reason="FIX TEST: Works on CHROME")
171170
def test_packages(self):
172171
self.pyscript_run(
173172
"""
@@ -188,15 +187,16 @@ def test_packages(self):
188187
"hello asciitree", # printed by us
189188
]
190189

191-
# TODO: if there's no <script type="py"> there are surely no plugins neither
192-
# this test must be discussed or rewritten to make sense now
193190
@pytest.mark.skip("FIXME: No banner")
194191
def test_non_existent_package(self):
195192
self.pyscript_run(
196193
"""
197194
<py-config>
198195
packages = ["i-dont-exist"]
199196
</py-config>
197+
<script type="py">
198+
print('hello')
199+
</script>
200200
""",
201201
wait_for_pyscript=False,
202202
)
@@ -211,15 +211,16 @@ def test_non_existent_package(self):
211211
assert expected_alert_banner_msg in alert_banner.inner_text()
212212
self.check_py_errors("Can't fetch metadata for 'i-dont-exist'")
213213

214-
# TODO: if there's no <script type="py"> there are surely no plugins neither
215-
# this test must be discussed or rewritten to make sense now
216214
@pytest.mark.skip("FIXME: No banner")
217215
def test_no_python_wheel(self):
218216
self.pyscript_run(
219217
"""
220218
<py-config>
221219
packages = ["opsdroid"]
222220
</py-config>
221+
<script type="py">
222+
print('hello')
223+
</script>
223224
""",
224225
wait_for_pyscript=False,
225226
)
@@ -350,7 +351,6 @@ def test_getPySrc_returns_source_code(self):
350351
assert script_py_tag.evaluate("node => node.srcCode") == 'print("hello from script py")'
351352

352353

353-
@pytest.mark.skip(reason="FIX TEST: works in chrome!")
354354
def test_py_attribute_without_id(self):
355355
self.pyscript_run(
356356
"""

pyscript.core/tests/integration/test_02_display.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import io
33
import os
44
import re
5+
import html
56

67
import numpy as np
78
import pytest
@@ -315,7 +316,6 @@ def test_display_list_dict_tuple(self):
315316
== "['A', 1, '!']\n{'B': 2, 'List': ['A', 1, '!']}\n('C', 3, '!')"
316317
)
317318

318-
@pytest.mark.skip("The asserts are commented out. Investigate")
319319
def test_display_should_escape(self):
320320
self.pyscript_run(
321321
"""
@@ -325,13 +325,10 @@ def test_display_should_escape(self):
325325
</script>
326326
"""
327327
)
328-
# out = self.page.locator("script-py > div")
329-
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
330-
node_list[0]
331-
# assert out.inner_html() == html.escape("<p>hello world</p>")
332-
# assert out.inner_text() == "<p>hello world</p>"
328+
out = self.page.locator("script-py > div")
329+
assert out.inner_html() == html.escape("<p>hello world</p>")
330+
assert out.inner_text() == '<p>hello world</p>'
333331

334-
@pytest.mark.skip("The asserts are commented out. Investigate")
335332
def test_display_HTML(self):
336333
self.pyscript_run(
337334
"""
@@ -341,17 +338,13 @@ def test_display_HTML(self):
341338
</script>
342339
"""
343340
)
344-
# out = self.page.locator("script-py > div")
345-
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
346-
node_list[0]
347-
# assert out.inner_html() == "<p>hello world</p>"
348-
# assert out.inner_text() == "hello world"
349-
350-
@pytest.mark.skip(
351-
"FIX TEST: Works correctly in Chrome, but fails in TEST with the error:\n\n"
352-
"It's likely that the Test framework injections in config are causing"
353-
"this error."
354-
)
341+
out = self.page.locator("script-py > div")
342+
assert out.inner_html() == "<p>hello world</p>"
343+
assert out.inner_text() == "hello world"
344+
345+
# waiit_for_pyscript is broken: it waits until the python code is about to
346+
# start, to until the python code has finished execution
347+
@pytest.mark.skip("FIXME: wait_for_pyscript is broken")
355348
def test_image_display(self):
356349
self.pyscript_run(
357350
"""
@@ -435,11 +428,6 @@ def test_console_line_break(self):
435428
assert console_text.index("1print") == (console_text.index("2print") - 1)
436429
assert console_text.index("1console") == (console_text.index("2console") - 1)
437430

438-
@pytest.mark.skip(
439-
"FIX TEST: Works correctly in Chrome, but fails in TEST with the error:\n\n"
440-
"It's likely that the Test framework injections in config are causing"
441-
"this error."
442-
)
443431
def test_image_renders_correctly(self):
444432
"""This is just a sanity check to make sure that images are rendered correctly."""
445433
buffer = io.BytesIO()

0 commit comments

Comments
 (0)
0