8000 Unskip some tests, delete others by antocuni · Pull Request #1742 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Unskip some tests, delete others #1742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyscript.core/tests/integration/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def filter_page_content(lines, exclude=None):


@pytest.mark.usefixtures("init")
@with_execution_thread("main", "worker")
@with_execution_thread("main") # , "worker") # XXX re-enable workers eventually
class PyScriptTest:
"""
Base class to write PyScript integration tests, based on playwright.
Expand Down Expand Up @@ -179,6 +179,7 @@ def init(self, request, tmpdir, logger, page, execution_thread):
# create a symlink to BUILD inside tmpdir
tmpdir.join("build").mksymlinkto(BUILD)
self.tmpdir.chdir()
self.tmpdir.join('favicon.ico').write("")
self.logger = logger
self.execution_thread = execution_thread
self.dev_server = None
Expand Down
12 changes: 6 additions & 6 deletions pyscript.core/tests/integration/test_01_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def test_escaping_of_angle_brackets(self):
"C true false",
"D <div></div>"]

@pytest.mark.skip(reason="FIX TEST: Works on CHROME")
def test_packages(self):
self.pyscript_run(
"""
Expand All @@ -188,15 +187,16 @@ def test_packages(self):
"hello asciitree", # printed by us
]

# TODO: if there's no <script type="py"> there are surely no plugins neither
# this test must be discussed or rewritten to make sense now
@pytest.mark.skip("FIXME: No banner")
def test_non_existent_package(self):
self.pyscript_run(
"""
<py-config>
packages = ["i-dont-exist"]
</py-config>
<script type="py">
print('hello')
</script>
""",
wait_for_pyscript=False,
)
Expand All @@ -211,15 +211,16 @@ def test_non_existent_package(self):
assert expected_alert_banner_msg in alert_banner.inner_text()
self.check_py_errors("Can't fetch metadata for 'i-dont-exist'")
10000
# TODO: if there's no <script type="py"> there are surely no plugins neither
# this test must be discussed or rewritten to make sense now
@pytest.mark.skip("FIXME: No banner")
def test_no_python_wheel(self):
self.pyscript_run(
"""
<py-config>
packages = ["opsdroid"]
</py-config>
<script type="py">
print('hello')
</script>
""",
wait_for_pyscript=False,
)
Expand Down Expand Up @@ -350,7 +351,6 @@ def test_getPySrc_returns_source_code(self):
assert script_py_tag.evaluate("node => node.srcCode") == 'print("hello from script py")'


@pytest.mark.skip(reason="FIX TEST: works in chrome!")
def test_py_attribute_without_id(self):
self.pyscript_run(
"""
Expand Down
34 changes: 11 additions & 23 deletions pyscript.core/tests/integration/test_02_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import io
import os
import re
import html

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

@pytest.mark.skip("The asserts are commented out. Investigate")
def test_display_should_escape(self):
self.pyscript_run(
"""
Expand All @@ -325,13 +325,10 @@ def test_display_should_escape(self):
</script>
"""
)
# out = self.page.locator("script-py > div")
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
node_list[0]
# assert out.inner_html() == html.escape("<p>hello world</p>")
# assert out.inner_text() == "<p>hello world</p>"
out = self.page.locator("script-py > div")
assert out.inner_html() == html.escape("<p>hello world</p>")
assert out.inner_text() == '<p>hello world</p>'

@pytest.mark.skip("The asserts are commented out. Investigate")
def test_display_HTML(self):
self.pyscript_run(
"""
Expand All @@ -341,17 +338,13 @@ def test_display_HTML(self):
</script>
"""
)
# out = self.page.locator("script-py > div")
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
node_list[0]
# assert out.inner_html() == "<p>hello world</p>"
# assert out.inner_text() == "hello world"

@pytest.mark.skip(
"FIX TEST: Works correctly in Chrome, but fails in TEST with the error:\n\n"
"It's likely that the Test framework injections in config are causing"
"this error."
)
out = self.page.locator("script-py > div")
assert out.inner_html() == "<p>hello world</p>"
assert out.inner_text() == "hello world"

# waiit_for_pyscript is broken: it waits until the python code is about to
# start, to until the python code has finished execution
@pytest.mark.skip("FIXME: wait_for_pyscript is broken")
def test_image_display(self):
self.pyscript_run(
"""
Expand Down Expand Up @@ -435,11 +428,6 @@ def test_console_line_break(self):
assert console_text.index("1print") == (console_text.index("2print") - 1)
assert console_text.index("1console") == (console_text.index("2console") - 1)

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