Bring tests to next (#1657)

* bring Makefile to root folder

* add back the print to console when pyscript is ready

* fix build path on tests, link to core.js and overall timeout since it now loads faster

* fix and mark some tests accordingly

* change default timeout to 20s

* review tests and skip what is a known regression

* more tests review until pycondif and skip what is a known regression

* fix pyodide version used on tests

* remove display from config test since it's not testing anything more than console already tests and display as its own tests

* disable config tests that rely on the banner

* skip REPL tests since it's not included in pyscript NEXT

* skip PyTerminal tests since it's not included in pyscript NEXT

* skip more tests relying on Element

* Fix wrong script type from py-script to py

* review more tests related to attributes and add test for worker

* skip spashscreen tests

* wrap up reviews on remaining tests

* update core

* update display tests to use import

* fix more tests and skip some that have known issues

* skip other 2 tests that fail because the test framework injects values that cause the config to fail

* fix getPySrc test due to changed interface

* another round of fixes and commenting on specific tests

---------

Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
This commit is contained in:
Fabio Pliger
2023-09-01 10:01:09 -07:00
committed by GitHub
parent ef44df5dda
commit 12428c0617
22 changed files with 451 additions and 137 deletions

135
Makefile Normal file
View File

@@ -0,0 +1,135 @@
tag := latest
git_hash ?= $(shell git log -1 --pretty=format:%h)
base_dir ?= $(shell git rev-parse --show-toplevel)
src_dir ?= $(base_dir)/pyscriptjs/src
examples ?= ../$(base_dir)/examples
app_dir ?= $(shell git rev-parse --show-prefix)
CONDA_EXE := conda
CONDA_ENV ?= $(base_dir)/pyscriptjs/env
env := $(CONDA_ENV)
conda_run := $(CONDA_EXE) run -p $(env)
PYTEST_EXE := $(CONDA_ENV)/bin/pytest
GOOD_NODE_VER := 14
GOOD_NPM_VER := 6
NODE_VER := $(shell node -v | cut -d. -f1 | sed 's/^v\(.*\)/\1/')
NPM_VER := $(shell npm -v | cut -d. -f1)
ifeq ($(shell uname -s), Darwin)
SED_I_ARG := -i ''
else
SED_I_ARG := -i
endif
GOOD_NODE := $(shell if [ $(NODE_VER) -ge $(GOOD_NODE_VER) ]; then echo true; else echo false; fi)
GOOD_NPM := $(shell if [ $(NPM_VER) -ge $(GOOD_NPM_VER) ]; then echo true; else echo false; fi)
.PHONY: check-node
check-node:
@echo Build requires Node $(GOOD_NODE_VER).x or higher: $(NODE_VER) detected && $(GOOD_NODE)
.PHONY: check-npm
check-npm:
@echo Build requires npm $(GOOD_NPM_VER).x or higher: $(NPM_VER) detected && $(GOOD_NPM)
setup:
make check-node
make check-npm
# npm install
$(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml
$(conda_run) playwright install
$(CONDA_EXE) install -c anaconda pytest -y
clean:
find . -name \*.py[cod] -delete
rm -rf .pytest_cache .coverage coverage.xml
clean-all: clean
rm -rf $(env) *.egg-info
shell:
@export CONDA_ENV_PROMPT='<{name}>'
@echo 'conda activate $(env)'
dev:
npm run dev
build:
npm run build
build-fast:
node esbuild.mjs
# use the following rule to do all the checks done by precommit: in
# particular, use this if you want to run eslint.
precommit-check:
pre-commit run --all-files
examples:
mkdir -p ./examples
cp -r ../examples/* ./examples
chmod -R 755 examples
find ./examples/toga -type f -name '*.html' -exec sed $(SED_I_ARG) s+https://pyscript.net/latest/+../../build/+g {} \;
find ./examples/webgl -type f -name '*.html' -exec sed $(SED_I_ARG) s+https://pyscript.net/latest/+../../../build/+g {} \;
find ./examples -type f -name '*.html' -exec sed $(SED_I_ARG) s+https://pyscript.net/latest/+../build/+g {} \;
npm run build
rm -rf ./examples/build
mkdir -p ./examples/build
cp -R ./build/* ./examples/build
@echo "To serve examples run: $(conda_run) python -m http.server 8080 --directory examples"
# run prerequisites and serve pyscript examples at http://localhost:8000/examples/
run-examples: setup build examples
make examples
npm install
make dev
test:
cd pyscript.core && npm run build && cp core.js ../pyscriptjs/build/core.js
make test-integration
make test-examples
# run all integration tests *including examples* sequentially
test-integration:
mkdir -p test_results
$(PYTEST_EXE) -vv $(ARGS) pyscriptjs/tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml
# run all integration tests *except examples* in parallel (examples use too much memory)
test-integration-parallel:
mkdir -p test_results
$(PYTEST_EXE) --numprocesses auto -vv $(ARGS) pyscript/tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml -k 'not zz_examples'
# run integration tests on only examples sequentially (to avoid running out of memory)
test-examples:
mkdir -p test_results
$(PYTEST_EXE) -vv $(ARGS) pyscript/tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml -k 'zz_examples'
test-py:
@echo "Tests from $(src_dir)"
mkdir -p test_results
$(PYTEST_EXE) -vv $(ARGS) tests/py-unit/ --log-cli-level=warning --junitxml=test_results/py-unit.xml
test-ts:
npm run test
fmt: fmt-py fmt-ts
@echo "Format completed"
fmt-check: fmt-ts-check fmt-py-check
@echo "Format check completed"
fmt-ts:
npm run format
fmt-ts-check:
npm run format:check
fmt-py:
$(conda_run) black --skip-string-normalization .
$(conda_run) isort --profile black .
fmt-py-check:
$(conda_run) black -l 88 --check .
.PHONY: $(MAKECMDGOALS)

View File

@@ -196,6 +196,7 @@ define("py", {
// resolve PyScriptElement to allow connectedCallback
element._pyodide.resolve(pyodide);
}
console.info("[pyscript/main] PyScript Ready");
},
});

View File

@@ -16,7 +16,7 @@ import toml
from playwright.sync_api import Error as PlaywrightError
ROOT = py.path.local(__file__).dirpath("..", "..", "..")
BUILD = ROOT.join("pyscriptjs", "build")
BUILD = ROOT.join("pyscript.core")
def params_with_marks(params):
@@ -104,6 +104,27 @@ def skip_worker(reason):
return decorator
def filter_inner_text(text, exclude=None):
return "\n".join(filter_page_content(text.splitlines(), exclude=exclude))
def filter_page_content(lines, exclude=None):
"""Remove lines that are not relevant for the test. By default, ignores:
('', 'execution_thread = "main"', 'execution_thread = "worker"')
Args:
lines (list): list of strings
exclude (list): list of strings to exclude
Returns:
list: list of strings
"""
if exclude is None:
exclude = {"", 'execution_thread = "main"', 'execution_thread = "worker"'}
return [line for line in lines if line not in exclude]
@pytest.mark.usefixtures("init")
@with_execution_thread("main", "worker")
class PyScriptTest:
@@ -134,6 +155,8 @@ class PyScriptTest:
creates an HTML page to run the specified snippet.
"""
DEFAULT_TIMEOUT = 20000
@pytest.fixture()
def init(self, request, tmpdir, logger, page, execution_thread):
"""
@@ -204,7 +227,7 @@ class PyScriptTest:
self.page = page
# set default timeout to 60000 millliseconds from 30000
page.set_default_timeout(60000)
page.set_default_timeout(self.DEFAULT_TIMEOUT)
self.console = ConsoleMessageCollection(self.logger)
self._js_errors = []
@@ -381,7 +404,7 @@ class PyScriptTest:
return text in self.console.all.lines
if timeout is None:
timeout = 30 * 1000
timeout = 10 * 1000
# NOTE: we cannot use playwright's own page.expect_console_message(),
# because if you call it AFTER the text has already been emitted, it
# waits forever. Instead, we have to use our own custom logic.
@@ -418,7 +441,7 @@ class PyScriptTest:
"""
# this is printed by interpreter.ts:Interpreter.initialize
elapsed_ms = self.wait_for_console(
"[pyscript/main] PyScript page fully initialized",
"[pyscript/main] PyScript Ready",
timeout=timeout,
check_js_errors=check_js_errors,
)
@@ -477,11 +500,14 @@ class PyScriptTest:
snippet, py_config_maybe = self._inject_execution_thread_config(
snippet, execution_thread
)
doc = f"""
<html>
<head>
<link rel="stylesheet" href="{self.http_server_addr}/build/pyscript.css" />
<script defer src="{self.http_server_addr}/build/pyscript.js"></script>
<script
type="module"
src="{self.http_server_addr}/build/core.js"
></script>
{extra_head}
</head>
<body>

View File

@@ -2,7 +2,7 @@ import re
import pytest
from .support import PyScriptTest, skip_worker
from .support import PyScriptTest
class TestBasic(PyScriptTest):
@@ -17,6 +17,11 @@ class TestBasic(PyScriptTest):
)
assert self.console.log.lines == ["hello pyscript"]
# TODO: I think this test actually should test that we don't load anything if there aren't
# any pyscrpt related tags or features. Meaning that the Platform is not invasive.
@pytest.mark.skip(
reason="DIFFERENT BEHAVIOUR: We don't print anything in the console once loaded"
)
def test_execution_thread(self):
self.pyscript_run(
"""
@@ -26,12 +31,15 @@ class TestBasic(PyScriptTest):
)
assert self.execution_thread in ("main", "worker")
if self.execution_thread == "main":
where = "the main thread"
pass
elif self.execution_thread == "worker":
where = "a web worker"
expected = f"[pyscript/main] Starting the interpreter in {where}"
pass
expected = ("[pyscript/main] PyScript Ready",)
assert expected in self.console.info.lines
@pytest.mark.skip(
reason="FIXME: No banner and should also add a WARNING about CORS"
)
def test_no_cors_headers(self):
self.disable_cors_headers()
self.pyscript_run(
@@ -66,6 +74,7 @@ class TestBasic(PyScriptTest):
)
assert self.console.log.lines[-1] == "hello pyscript"
@pytest.mark.skip("FIXME: No banner")
def test_python_exception(self):
self.pyscript_run(
"""
@@ -80,8 +89,7 @@ class TestBasic(PyScriptTest):
#
# check that we sent the traceback to the console
tb_lines = self.console.error.lines[-1].splitlines()
assert tb_lines[0] == "[pyexec] Python exception:"
assert tb_lines[1] == "Traceback (most recent call last):"
assert tb_lines[0] == "Python Error: Traceback (most recent call last):"
assert tb_lines[-1] == "Exception: this is an error"
#
# check that we show the traceback in the page. Note that here we
@@ -93,12 +101,13 @@ class TestBasic(PyScriptTest):
assert tb_lines[0] == "Traceback (most recent call last):"
assert tb_lines[-1] == "Exception: this is an error"
@pytest.mark.skip(reason="FIX TEST: Works on CHROME")
def test_python_exception_in_event_handler(self):
self.pyscript_run(
"""
<button py-click="onclick()">Click me</button>
<button py-click="onclick">Click me</button>
<py-script>
def onclick():
def onclick(event):
raise Exception("this is an error inside handler")
</py-script>
"""
@@ -142,6 +151,7 @@ class TestBasic(PyScriptTest):
"four",
]
@pytest.mark.skip(reason="FIXME: log('<div></div>') now logs an empty string.")
def test_escaping_of_angle_brackets(self):
"""
Check that py-script tags escape angle brackets
@@ -155,12 +165,11 @@ class TestBasic(PyScriptTest):
assert self.console.log.lines[-2:] == ["true false", "<div></div>"]
@pytest.mark.skip(reason="FIX TEST: Works on CHROME")
def test_packages(self):
self.pyscript_run(
"""
<py-config>
# we use asciitree because it's one of the smallest packages
# which are built and distributed with pyodide
packages = ["asciitree"]
</py-config>
<py-script>
@@ -177,7 +186,7 @@ class TestBasic(PyScriptTest):
"hello asciitree", # printed by us
]
@skip_worker("FIXME: the banner doesn't appear")
@pytest.mark.skip("FIXME: No banner")
def test_non_existent_package(self):
self.pyscript_run(
"""
@@ -198,7 +207,7 @@ class TestBasic(PyScriptTest):
assert expected_alert_banner_msg in alert_banner.inner_text()
self.check_py_errors("Can't fetch metadata for 'i-dont-exist'")
@skip_worker("FIXME: the banner doesn't appear")
@pytest.mark.skip("FIXME: No banner")
def test_no_python_wheel(self):
self.pyscript_run(
"""
@@ -218,18 +227,20 @@ class TestBasic(PyScriptTest):
assert expected_alert_banner_msg in alert_banner.inner_text()
self.check_py_errors("Can't find a pure Python 3 wheel for 'opsdroid'")
@pytest.mark.skip("""FIXME: Dynamically adding a py-script tag fails""")
def test_dynamically_add_py_script_tag(self):
self.pyscript_run(
"""
<script>
function addPyScriptTag() {
function addPyScriptTag(event) {
let tag = document.createElement('py-script');
tag.innerHTML = "print('hello world')";
document.body.appendChild(tag);
}
</script>
<button onclick="addPyScriptTag()">Click me</button>
"""
""",
timeout=20000,
)
self.page.locator("button").click()
@@ -245,6 +256,7 @@ class TestBasic(PyScriptTest):
)
assert self.console.log.lines[-1] == "hello from foo"
@pytest.mark.skip("FIXME: No banner")
def test_py_script_src_not_found(self):
self.pyscript_run(
"""
@@ -263,6 +275,7 @@ class TestBasic(PyScriptTest):
self.check_js_errors(expected_msg)
@pytest.mark.skip("DIFFERENT BEHAVIOUR?: we don't expose pyscript on window")
def test_js_version(self):
self.pyscript_run(
"""
@@ -277,6 +290,7 @@ class TestBasic(PyScriptTest):
is not None
)
@pytest.mark.skip("DIFFERENT BEHAVIOUR?: we don't expose pyscript on window")
def test_python_version(self):
self.pyscript_run(
"""
@@ -300,7 +314,7 @@ class TestBasic(PyScriptTest):
is not None
)
@skip_worker("FIXME: showWarning()")
@pytest.mark.skip("FIXME: No banner")
def test_assert_no_banners(self):
"""
Test that the DOM doesn't contain error/warning banners
@@ -314,31 +328,29 @@ class TestBasic(PyScriptTest):
</py-script>
"""
)
# check that we have 2 banners
with pytest.raises(AssertionError, match="Found 2 alert banners"):
self.assert_no_banners()
def test_getPySrc_returns_source_code(self):
self.pyscript_run(
"""
<py-script>
print("hello world!")
</py-script>
<py-script>print("hello world!")</py-script>
"""
)
pyscript_tag = self.page.locator("py-script")
assert pyscript_tag.inner_html() == ""
assert (
pyscript_tag.evaluate("node => node.getPySrc()")
== 'print("hello world!")\n'
)
assert pyscript_tag.evaluate("node => node.srcCode") == 'print("hello world!")'
@pytest.mark.skip(reason="FIX TEST: works in chrome!")
def test_py_attribute_without_id(self):
self.pyscript_run(
"""
<button py-click="myfunc()">Click me</button>
<button py-click="myfunc">Click me</button>
<py-script>
def myfunc():
def myfunc(event):
print("hello world!")
</py-script>
"""
@@ -349,6 +361,8 @@ class TestBasic(PyScriptTest):
assert self.console.log.lines[-1] == "hello world!"
assert self.console.error.lines == []
# TODO: THis can actually be removed since we are removing `py-mount`
@pytest.mark.skip("REMOVE TEST: No py-mount anymore")
def test_py_mount_shows_deprecation_warning(self):
# last non-deprecated version: 2023.03.1
self.pyscript_run(

View File

@@ -1,53 +1,67 @@
import base64
import html
import io
import os
import re
import numpy as np
import pytest
from PIL import Image
from .support import PyScriptTest, skip_worker, wait_for_render
from .support import (
PyScriptTest,
filter_inner_text,
filter_page_content,
wait_for_render,
)
DISPLAY_OUTPUT_ID_PATTERN = r'[id^="py-"]'
class TestDisplay(PyScriptTest):
@skip_worker("FIXME: display()")
@pytest.mark.skip(
"DIFFERENT BEHAVIOUR!: display w/o target renders as TXT without <div> tag"
)
def test_simple_display(self):
self.pyscript_run(
"""
<py-script>
display('hello world')
print('ciao')
from pyscript import display
display("hello world")
</py-script>
"""
""",
timeout=20000,
)
node_list = self.page.query_selector_all(r'[id^="py-internal"]')
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
pattern = r"<div>hello world</div>"
assert re.search(pattern, node_list[0].inner_html())
assert node_list[0].inner_html() == pattern
assert len(node_list) == 1
@skip_worker("FIXME: display()")
def test_consecutive_display(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello 1')
</py-script>
<p>hello 2</p>
<py-script>
from pyscript import display
display('hello 3')
</py-script>
"""
)
inner_text = self.page.inner_text("body")
lines = inner_text.splitlines()
lines = [line for line in lines if line != ""] # remove empty lines
lines = [line for line in filter_page_content(lines)] # remove empty lines
assert lines == ["hello 1", "hello 2", "hello 3"]
@skip_worker("FIXME: display()")
def test_target_attribute(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello world', target="mydiv")
</py-script>
<div id="mydiv"></div>
@@ -56,32 +70,35 @@ class TestDisplay(PyScriptTest):
mydiv = self.page.locator("#mydiv")
assert mydiv.inner_text() == "hello world"
@skip_worker("FIXME: display()")
def test_consecutive_display_target(self):
self.pyscript_run(
"""
<py-script id="first">
from pyscript import display
display('hello 1')
</py-script>
<p>hello in between 1 and 2</p>
<py-script id="second">
from pyscript import display
display('hello 2', target="second")
</py-script>
<py-script id="third">
from pyscript import display
display('hello 3')
</py-script>
"""
)
inner_text = self.page.inner_text("body")
lines = inner_text.splitlines()
lines = [line for line in lines if line != ""] # remove empty lines
lines = [line for line in filter_page_content(lines)] # remove empty lines
assert lines == ["hello 1", "hello in between 1 and 2", "hello 2", "hello 3"]
@skip_worker("FIXME: display()")
@pytest.mark.skip("DIFFERENT BEHAVIOUR!: display is not appending by default")
def test_multiple_display_calls_same_tag(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello')
display('world')
</py-script>
@@ -89,18 +106,20 @@ class TestDisplay(PyScriptTest):
)
tag = self.page.locator("py-script")
lines = tag.inner_text().splitlines()
# TODO: Did the default change to append=False?
assert lines == ["hello", "world"]
@skip_worker("FIXME: display()")
def test_implicit_target_from_a_different_tag(self):
self.pyscript_run(
"""
<py-script id="py1">
from pyscript import display
def say_hello():
display('hello')
</py-script>
<py-script id="py2">
from pyscript import display
say_hello()
</py-script>
"""
@@ -110,11 +129,14 @@ class TestDisplay(PyScriptTest):
assert py1.inner_text() == ""
assert py2.inner_text() == "hello"
@skip_worker("FIXME: display()")
@pytest.mark.skip(
"DIFFERENT BEHAVIOUR!: display is not raising Implicit target exception"
)
def test_no_implicit_target(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
def display_hello():
# this fails because we don't have any implicit target
# from event handlers
@@ -127,6 +149,8 @@ class TestDisplay(PyScriptTest):
self.check_py_errors("Implicit target not allowed here")
## error in console
tb_lines = self.console.error.lines[-1].splitlines()
# TODO: This does seem like a regression
assert tb_lines[0] == "[pyexec] Python exception:"
assert tb_lines[1] == "Traceback (most recent call last):"
assert (
@@ -137,11 +161,11 @@ class TestDisplay(PyScriptTest):
text = self.page.text_content("body")
assert "hello world" not in text
@skip_worker("FIXME: display()")
def test_explicit_target_pyscript_tag(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
def display_hello():
display('hello', target='second-pyscript-tag')
</py-script>
@@ -153,26 +177,31 @@ class TestDisplay(PyScriptTest):
text = self.page.locator("id=second-pyscript-tag").inner_text()
assert text == "hello"
@skip_worker("FIXME: display()")
@pytest.mark.skip(
"FIXME: in Chrome fails with the error:"
' The interpreter "py" was not found. Available interpreters are: "py-script", "pyodide".'
)
def test_explicit_target_on_button_tag(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
def display_hello():
display('hello', target='my-button')
</py-script>
<button id="my-button" py-click="display_hello()">Click me</button>
<button id="my-button" py-click="display_hello">Click me</button>
"""
)
self.page.locator("text=Click me").click()
text = self.page.locator("id=my-button").inner_text()
# TODO: This does seem like a regression that
assert "hello" in text
@skip_worker("FIXME: display()")
def test_explicit_different_target_from_call(self):
self.pyscript_run(
"""
<py-script id="first-pyscript-tag">
from pyscript import display
def display_hello():
display('hello', target='second-pyscript-tag')
</py-script>
@@ -187,25 +216,26 @@ class TestDisplay(PyScriptTest):
text = self.page.locator("id=second-pyscript-tag").all_inner_texts()
assert "hello" in text
@skip_worker("FIXME: display()")
def test_append_true(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello world', append=True)
</py-script>
"""
)
node_list = self.page.query_selector_all(r'[id^="py-internal"]')
node_list = self.page.query_selector_all(DISPLAY_OUTPUT_ID_PATTERN)
pattern = r"<div>hello world</div>"
assert re.search(pattern, node_list[0].inner_html())
assert node_list[0].inner_html() == pattern
assert len(node_list) == 1
@skip_worker("FIXME: display()")
def test_append_false(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello world', append=False)
</py-script>
"""
@@ -214,11 +244,12 @@ class TestDisplay(PyScriptTest):
pattern = r'<py-script id="py-.*">hello world</py-script>'
assert re.search(pattern, inner_html)
@skip_worker("FIXME: display()")
@pytest.mark.skip("FIXME: display doesn't seem to have append=True as default")
def test_display_multiple_values(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
hello = 'hello'
world = 'world'
display(hello, world)
@@ -228,11 +259,11 @@ class TestDisplay(PyScriptTest):
inner_text = self.page.inner_text("html")
assert inner_text == "hello\nworld"
@skip_worker("FIXME: display()")
def test_display_multiple_append_false(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display('hello', append=False)
display('world', append=False)
</py-script>
@@ -242,12 +273,13 @@ class TestDisplay(PyScriptTest):
pattern = r'<py-script id="py-.*">world</py-script>'
assert re.search(pattern, inner_html)
@skip_worker("FIXME: display()")
@pytest.mark.skip("WEIRDLY BROKEN not because of Display?")
def test_display_multiple_append_false_with_target(self):
self.pyscript_run(
"""
<div id="circle-div"></div>
<script type="py">
<py-script>
from pyscript import display
class Circle:
r = 0
def _repr_svg_(self):
@@ -272,11 +304,12 @@ class TestDisplay(PyScriptTest):
)
assert self.console.error.lines == []
@skip_worker("FIXME: display()")
@pytest.mark.skip("FIXME: display doesn't seem to have append=True as default")
def test_display_list_dict_tuple(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
l = ['A', 1, '!']
d = {'B': 2, 'List': l}
t = ('C', 3, '!')
@@ -285,44 +318,58 @@ class TestDisplay(PyScriptTest):
"""
)
inner_text = self.page.inner_text("html")
print(inner_text)
filtered_inner_text = filter_inner_text(inner_text)
print(filtered_inner_text)
assert (
inner_text
filtered_inner_text
== "['A', 1, '!']\n{'B': 2, 'List': ['A', 1, '!']}\n('C', 3, '!')"
)
@skip_worker("FIXME: display()")
@pytest.mark.skip(
"DIFFERENT BEHAVIOUR!: display w/o target renders as TXT without <div> tag"
)
def test_display_should_escape(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
display("<p>hello world</p>")
</py-script>
"""
)
out = self.page.locator("py-script > div")
assert out.inner_html() == html.escape("<p>hello world</p>")
assert out.inner_text() == "<p>hello world</p>"
# out = self.page.locator("py-script > 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>"
@skip_worker("FIXME: display()")
@pytest.mark.skip("FIXME: HTML has been removed from pyscript")
def test_display_HTML(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display, HTML
display(HTML("<p>hello world</p>"))
</py-script>
"""
)
out = self.page.locator("py-script > div")
assert out.inner_html() == "<p>hello world</p>"
assert out.inner_text() == "hello world"
# out = self.page.locator("py-script > 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"
@skip_worker("FIXME: display()")
@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_display(self):
self.pyscript_run(
"""
<py-config> packages = ["matplotlib"] </py-config>
<py-script>
from pyscript import display
import matplotlib.pyplot as plt
xpoints = [3, 6, 9]
ypoints = [1, 2, 3]
@@ -346,11 +393,13 @@ class TestDisplay(PyScriptTest):
assert deviation == 0.0
self.assert_no_banners()
@skip_worker("FIXME: display()")
# @pytest.mark.skip("FIXME: display() without target is broken")
def test_empty_HTML_and_console_output(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
import js
print('print from python')
js.console.log('print from js')
js.console.error('error from js');
@@ -364,11 +413,13 @@ class TestDisplay(PyScriptTest):
assert "print from js" in console_text
assert "error from js" in console_text
@skip_worker("FIXME: display()")
# @pytest.mark.skip("FIXME: display() without target is broken")
def test_text_HTML_and_console_output(self):
self.pyscript_run(
"""
<py-script>
from pyscript import display
import js
display('this goes to the DOM')
print('print from python')
js.console.log('print from js')
@@ -385,7 +436,6 @@ class TestDisplay(PyScriptTest):
print(self.console.error.lines)
assert self.console.error.lines[-1] == "error from js"
@skip_worker("FIXME: display()")
def test_console_line_break(self):
self.pyscript_run(
"""
@@ -399,7 +449,11 @@ class TestDisplay(PyScriptTest):
assert console_text.index("1print") == (console_text.index("2print") - 1)
assert console_text.index("1console") == (console_text.index("2console") - 1)
@skip_worker("FIXME: display()")
@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()
@@ -417,6 +471,7 @@ class TestDisplay(PyScriptTest):
<div id="img-target" />
<py-script>
from pyscript import display
from PIL import Image
img = Image.new("RGB", (4, 4), color=(0, 0, 0))
display(img, target='img-target', append=False)

View File

@@ -1,9 +1,12 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest
class TestElement(PyScriptTest):
"""Test the Element api"""
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_id(self):
"""Test the element id"""
self.pyscript_run(
@@ -21,7 +24,7 @@ class TestElement(PyScriptTest):
py_terminal = self.page.wait_for_selector("py-terminal")
assert "foo" in py_terminal.inner_text()
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_value(self):
"""Test the element value"""
self.pyscript_run(
@@ -39,7 +42,7 @@ class TestElement(PyScriptTest):
py_terminal = self.page.wait_for_selector("py-terminal")
assert "bar" in py_terminal.inner_text()
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_innerHtml(self):
"""Test the element innerHtml"""
self.pyscript_run(
@@ -57,7 +60,7 @@ class TestElement(PyScriptTest):
py_terminal = self.page.wait_for_selector("py-terminal")
assert "bar" in py_terminal.inner_text()
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_write_no_append(self):
"""Test the element write"""
self.pyscript_run(
@@ -74,7 +77,7 @@ class TestElement(PyScriptTest):
div = self.page.wait_for_selector("#foo")
assert "World!" in div.inner_text()
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_write_append(self):
"""Test the element write"""
self.pyscript_run(
@@ -94,7 +97,7 @@ class TestElement(PyScriptTest):
# confirm that the second write was appended
assert "Hello!<div>World!</div>" in parent_div.inner_html()
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_clear_div(self):
"""Test the element clear"""
self.pyscript_run(
@@ -110,7 +113,7 @@ class TestElement(PyScriptTest):
div = self.page.locator("#foo")
assert div.inner_text() == ""
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_clear_input(self):
"""Test the element clear"""
self.pyscript_run(
@@ -126,7 +129,7 @@ class TestElement(PyScriptTest):
input = self.page.wait_for_selector("#foo")
assert input.input_value() == ""
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_select(self):
"""Test the element select"""
self.pyscript_run(
@@ -143,7 +146,7 @@ class TestElement(PyScriptTest):
)
assert self.console.log.lines[-1] == "bar"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_select_content(self):
"""Test the element select"""
self.pyscript_run(
@@ -160,7 +163,7 @@ class TestElement(PyScriptTest):
)
assert self.console.log.lines[-1] == "Bar"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_clone_no_id(self):
"""Test the element clone"""
self.pyscript_run(
@@ -178,7 +181,7 @@ class TestElement(PyScriptTest):
assert divs.first.inner_text() == "Hello!"
assert divs.last.inner_text() == "Hello!"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_clone_with_id(self):
"""Test the element clone"""
self.pyscript_run(
@@ -198,7 +201,7 @@ class TestElement(PyScriptTest):
clone = self.page.locator("#bar")
assert clone.inner_text() == "Hello!"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_clone_to_other_element(self):
"""Test the element clone"""
self.pyscript_run(
@@ -233,7 +236,7 @@ class TestElement(PyScriptTest):
# Make sure that the clones are rendered in the right order
assert container_div.inner_text() == "Bond\nJames\nBond"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_remove_single_class(self):
"""Test the element remove_class"""
self.pyscript_run(
@@ -249,7 +252,7 @@ class TestElement(PyScriptTest):
div = self.page.locator("#foo")
assert div.get_attribute("class") == "baz"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_element_remove_multiple_classes(self):
"""Test the element remove_class"""
self.pyscript_run(
@@ -265,7 +268,7 @@ class TestElement(PyScriptTest):
div = self.page.locator("#foo")
assert div.get_attribute("class") == ""
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_element_add_single_class(self):
"""Test the element add_class"""
self.pyscript_run(
@@ -282,7 +285,7 @@ class TestElement(PyScriptTest):
div = self.page.locator("#foo")
assert div.get_attribute("class") == "red"
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_element_add_multiple_class(self):
"""Test the element add_class"""
self.pyscript_run(

View File

@@ -1,4 +1,6 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest, filter_inner_text
class TestAsync(PyScriptTest):
@@ -87,28 +89,29 @@ class TestAsync(PyScriptTest):
"b func done",
]
@skip_worker("FIXME: display()")
def test_multiple_async_multiple_display_targeted(self):
self.pyscript_run(
"""
<py-script id='pyA'>
from pyscript import display
import js
import asyncio
async def a_func():
for i in range(2):
display(f'A{i}', target='pyA')
display(f'A{i}', target='pyA', append=True)
await asyncio.sleep(0.1)
asyncio.ensure_future(a_func())
</py-script>
<py-script id='pyB'>
from pyscript import display
import js
import asyncio
async def a_func():
for i in range(2):
display(f'B{i}', target='pyB')
display(f'B{i}', target='pyB', append=True)
await asyncio.sleep(0.1)
js.console.log("B DONE")
@@ -118,13 +121,14 @@ class TestAsync(PyScriptTest):
)
self.wait_for_console("B DONE")
inner_text = self.page.inner_text("html")
assert "A0\nA1\nB0\nB1" in inner_text
assert "A0\nA1\nB0\nB1" in filter_inner_text(inner_text)
@skip_worker("FIXME: display()")
@pytest.mark.skip("FIXME: display in implicit target WAS not allowed")
def test_async_display_untargeted(self):
self.pyscript_run(
"""
<py-script id='pyA'>
from pyscript import display
import asyncio
import js

View File

@@ -1,8 +1,13 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest
pytest.skip(
reason="FIXME: @when decorator missing from pyscript", allow_module_level=True
)
class TestEventHandler(PyScriptTest):
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_when_decorator_with_event(self):
"""When the decorated function takes a single parameter,
it should be passed the event object
@@ -24,7 +29,6 @@ class TestEventHandler(PyScriptTest):
assert "I've clicked [object HTMLButtonElement] with id foo_id" in console_text
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_when_decorator_without_event(self):
"""When the decorated function takes no parameters (not including 'self'),
it should be called without the event object
@@ -45,7 +49,6 @@ class TestEventHandler(PyScriptTest):
assert "The button was clicked" in self.console.log.lines
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_multiple_when_decorators_with_event(self):
self.pyscript_run(
"""
@@ -73,7 +76,6 @@ class TestEventHandler(PyScriptTest):
assert "I've clicked [object HTMLButtonElement] with id bar_id" in console_text
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_two_when_decorators(self):
"""When decorating a function twice, both should function"""
self.pyscript_run(
@@ -96,7 +98,6 @@ class TestEventHandler(PyScriptTest):
assert "An event of type click happened" in self.console.log.lines
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_two_when_decorators_same_element(self):
"""When decorating a function twice *on the same DOM element*, both should function"""
self.pyscript_run(
@@ -118,7 +119,6 @@ class TestEventHandler(PyScriptTest):
assert "An event of type click happened" in self.console.log.lines
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_when_decorator_multiple_elements(self):
"""The @when decorator's selector should successfully select multiple
DOM elements
@@ -142,7 +142,6 @@ class TestEventHandler(PyScriptTest):
assert "button2 was clicked" in self.console.log.lines
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_when_decorator_duplicate_selectors(self):
""" """
self.pyscript_run(
@@ -166,7 +165,6 @@ class TestEventHandler(PyScriptTest):
)
self.assert_no_banners()
@skip_worker(reason="FIXME: js.document (@when decorator)")
def test_when_decorator_invalid_selector(self):
"""When the selector parameter of @when is invalid, it should show an error"""
self.pyscript_run(

View File

@@ -1,5 +1,12 @@
import pytest
from .support import PyScriptTest
pytest.skip(
reason="FIXME: pyscript API changed doesn't expose pyscript to window anymore",
allow_module_level=True,
)
class TestInterpreterAccess(PyScriptTest):
"""Test accessing Python objects from JS via pyscript.interpreter"""

View File

@@ -1,5 +1,12 @@
import pytest
from .support import PyScriptTest, skip_worker
pytest.skip(
reason="FIX LATER: pyscript NEXT doesn't support plugins yet",
allow_module_level=True,
)
# Source code of a simple plugin that creates a Custom Element for testing purposes
CE_PLUGIN_CODE = """
from pyscript import Plugin

View File

@@ -8,14 +8,19 @@ import requests
from .support import PyScriptTest, with_execution_thread
PYODIDE_VERSION = "0.23.4"
@pytest.fixture
def pyodide_0_22_0_tar(request):
def pyodide_tar(request):
"""
Fixture which returns a local copy of pyodide. It uses pytest-cache to
avoid re-downloading it between runs.
"""
URL = "https://github.com/pyodide/pyodide/releases/download/0.22.0/pyodide-core-0.22.0.tar.bz2"
URL = (
f"https://github.com/pyodide/pyodide/releases/download/{PYODIDE_VERSION}/"
f"pyodide-core-{PYODIDE_VERSION}.tar.bz2"
)
tar_name = Path(URL).name
val = request.config.cache.get(tar_name, None)
@@ -45,6 +50,9 @@ def unzip(location, extract_to="."):
# of config
@with_execution_thread(None)
class TestConfig(PyScriptTest):
@pytest.mark.skip(
"FIXME: API has changed and there's no pyscript_get_config anymore"
)
def test_py_config_inline(self):
self.pyscript_run(
"""
@@ -61,6 +69,9 @@ class TestConfig(PyScriptTest):
)
assert self.console.log.lines[-1] == "config name: foobar"
@pytest.mark.skip(
"FIXME: API has changed and there's no pyscript_get_config anymore"
)
def test_py_config_external(self):
pyconfig_toml = """
name = "app with external config"
@@ -87,8 +98,8 @@ class TestConfig(PyScriptTest):
# The test checks if loading a different interpreter is possible
# and that too from a locally downloaded file without needing
# the use of explicit `indexURL` calculation.
def test_interpreter_config(self, pyodide_0_22_0_tar):
unzip(pyodide_0_22_0_tar, extract_to=self.tmpdir)
def test_interpreter_config(self, pyodide_tar):
unzip(pyodide_tar, extract_to=self.tmpdir)
self.pyscript_run(
"""
<py-config type="json">
@@ -105,19 +116,15 @@ class TestConfig(PyScriptTest):
import sys, js
pyodide_version = sys.modules["pyodide"].__version__
js.console.log("version", pyodide_version)
display(pyodide_version)
</py-script>
""",
)
assert self.console.log.lines[-1] == "version 0.22.0"
version = self.page.locator("py-script").inner_text()
assert version == "0.22.0"
assert self.console.log.lines[-1] == f"version {PYODIDE_VERSION}"
def test_runtime_still_works_but_shows_deprecation_warning(
self, pyodide_0_22_0_tar
):
unzip(pyodide_0_22_0_tar, extract_to=self.tmpdir)
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_runtime_still_works_but_shows_deprecation_warning(self, pyodide_tar):
unzip(pyodide_tar, extract_to=self.tmpdir)
self.pyscript_run(
"""
<py-config type="json">
@@ -134,14 +141,11 @@ class TestConfig(PyScriptTest):
import sys, js
pyodide_version = sys.modules["pyodide"].__version__
js.console.log("version", pyodide_version)
display(pyodide_version)
</py-script>
""",
)
assert self.console.log.lines[-1] == "version 0.22.0"
version = self.page.locator("py-script").inner_text()
assert version == "0.22.0"
assert self.console.log.lines[-1] == f"version {PYODIDE_VERSION}"
deprecation_banner = self.page.wait_for_selector(".alert-banner")
expected_message = (
@@ -150,6 +154,7 @@ class TestConfig(PyScriptTest):
)
assert deprecation_banner.inner_text() == expected_message
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_invalid_json_config(self):
# we need wait_for_pyscript=False because we bail out very soon,
# before being able to write 'PyScript page fully initialized'
@@ -169,6 +174,7 @@ class TestConfig(PyScriptTest):
)
assert banner.inner_text() == expected
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_invalid_toml_config(self):
# we need wait_for_pyscript=False because we bail out very soon,
# before being able to write 'PyScript page fully initialized'
@@ -189,6 +195,7 @@ class TestConfig(PyScriptTest):
)
assert banner.inner_text() == expected
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_multiple_py_config(self):
self.pyscript_run(
"""
@@ -214,6 +221,7 @@ class TestConfig(PyScriptTest):
)
assert banner.text_content() == expected
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_no_interpreter(self):
snippet = """
<py-config type="json">
@@ -228,6 +236,7 @@ class TestConfig(PyScriptTest):
div.text_content() == "(PY1000): Fatal error: config.interpreter is empty"
)
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_multiple_interpreter(self):
snippet = """
<py-config type="json">
@@ -283,6 +292,7 @@ class TestConfig(PyScriptTest):
"hello from B",
]
@pytest.mark.skip("FIXME: We need to restore the banner.")
def test_paths_that_do_not_exist(self):
self.pyscript_run(
"""

View File

@@ -1,7 +1,14 @@
import platform
import pytest
from .support import PyScriptTest, skip_worker
pytest.skip(
reason="FIX LATER: pyscript NEXT doesn't support the REPL yet",
allow_module_level=True,
)
class TestPyRepl(PyScriptTest):
def _replace(self, py_repl, newcode):

View File

@@ -1,9 +1,15 @@
import time
import pytest
from playwright.sync_api import expect
from .support import PyScriptTest, skip_worker
pytest.skip(
reason="FIX LATER: pyscript NEXT doesn't support the Terminal yet",
allow_module_level=True,
)
class TestPyTerminal(PyScriptTest):
def test_py_terminal(self):

View File

@@ -1,8 +1,10 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest
class TestPyScriptRuntimeAttributes(PyScriptTest):
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_injected_html_with_py_event(self):
self.pyscript_run(
r"""
@@ -21,7 +23,7 @@ class TestPyScriptRuntimeAttributes(PyScriptTest):
self.page.locator("button").click()
assert self.console.log.lines == ["hello pyscript"]
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_added_py_event(self):
self.pyscript_run(
r"""
@@ -40,7 +42,7 @@ class TestPyScriptRuntimeAttributes(PyScriptTest):
self.page.locator("button").click()
assert self.console.log.lines == ["hello pyscript"]
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_added_then_removed_py_event(self):
self.pyscript_run(
r"""

View File

@@ -1,8 +1,10 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest
class TestScriptTypePyScript(PyScriptTest):
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: display() without target is broken")
def test_display_line_break(self):
self.pyscript_run(
r"""
@@ -14,7 +16,7 @@ class TestScriptTypePyScript(PyScriptTest):
text_content = self.page.locator("py-script-tag").text_content()
assert "hello\nworld" == text_content
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: display() without target is broken")
def test_amp(self):
self.pyscript_run(
r"""
@@ -26,7 +28,7 @@ class TestScriptTypePyScript(PyScriptTest):
text_content = self.page.locator("py-script-tag").text_content()
assert "a &amp; b" == text_content
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: display() without target is broken")
def test_quot(self):
self.pyscript_run(
r"""
@@ -38,7 +40,7 @@ class TestScriptTypePyScript(PyScriptTest):
text_content = self.page.locator("py-script-tag").text_content()
assert "a &quot; b" == text_content
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: display() without target is broken")
def test_lt_gt(self):
self.pyscript_run(
r"""
@@ -50,7 +52,7 @@ class TestScriptTypePyScript(PyScriptTest):
text_content = self.page.locator("py-script-tag").text_content()
assert "< &lt; &gt; >" == text_content
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: display() without target is broken")
def test_dynamically_add_script_type_py_tag(self):
self.pyscript_run(
"""
@@ -70,22 +72,30 @@ class TestScriptTypePyScript(PyScriptTest):
self.page.wait_for_selector("py-terminal")
assert self.console.log.lines[-1] == "hello world"
@skip_worker("FIXME: js.document")
def test_script_type_py_src_attribute(self):
self.writefile("foo.py", "print('hello from foo')")
self.pyscript_run(
"""
<script type="py-script" src="foo.py"></script>
<script type="py" src="foo.py"></script>
"""
)
assert self.console.log.lines[-1] == "hello from foo"
@skip_worker("FIXME: js.document")
def test_script_type_py_worker_attribute(self):
self.writefile("foo.py", "print('hello from foo')")
self.pyscript_run(
"""
<script type="py" worker="foo.py"></script>
"""
)
assert self.console.log.lines[-1] == "hello from foo"
@pytest.mark.skip("FIXME: script output attribute is broken")
def test_script_type_py_output_attribute(self):
self.pyscript_run(
"""
<div id="first"></div>
<script type="py-script" output="first">
<script type="py" output="first">
print("<p>Hello</p>")
</script>
"""
@@ -93,7 +103,7 @@ class TestScriptTypePyScript(PyScriptTest):
text = self.page.locator("#first").text_content()
assert "<p>Hello</p>" in text
@skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: script stderr attribute is broken")
def test_script_type_py_stderr_attribute(self):
self.pyscript_run(
"""

View File

@@ -1,8 +1,11 @@
from .support import PyScriptTest, skip_worker
import pytest
from .support import PyScriptTest
class TestShadowRoot(PyScriptTest):
@skip_worker("FIXME: js.document")
# @skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element missing from PyScript")
def test_reachable_shadow_root(self):
self.pyscript_run(
r"""

View File

@@ -1,7 +1,12 @@
import pytest
from playwright.sync_api import expect
from .support import PyScriptTest, skip_worker
pytest.skip(
reason="DECIDE: Should we remove the splashscreen?", allow_module_level=True
)
class TestSplashscreen(PyScriptTest):
def test_autoshow_and_autoclose(self):

View File

@@ -1,5 +1,9 @@
import pytest
from .support import PyScriptTest, skip_worker
pytest.skip(reason="FIXME: entire stdio should be reviewed", allow_module_level=True)
class TestOutputHandling(PyScriptTest):
# Source of a script to test the TargetedStdio functionality

View File

@@ -1,7 +1,13 @@
import pytest
from playwright.sync_api import expect
from .support import PyScriptTest, skip_worker
pytest.skip(
reason="FIX TESTS: These tests should reflect new PyScript and remove/change css ",
allow_module_level=True,
)
class TestStyle(PyScriptTest):
def test_pyscript_not_defined(self):

View File

@@ -1,5 +1,9 @@
import pytest
from .support import PyScriptTest
pytest.skip(reason="FIXME: Restore the banner", allow_module_level=True)
class TestWarningsAndBanners(PyScriptTest):
# Test the behavior of generated warning banners

View File

@@ -11,6 +11,9 @@ from PIL import Image
from .support import ROOT, PyScriptTest, wait_for_render, with_execution_thread
@pytest.mark.skip(
reason="SKIPPING EXAMPLES: these should be moved elsewhere and updated"
)
@with_execution_thread(None)
@pytest.mark.usefixtures("chdir")
class TestExamples(PyScriptTest):

View File

@@ -1,8 +1,12 @@
import re
import pytest
from .support import PyScriptTest, skip_worker
@pytest.mark.skip(
reason="SKIPPING Docs: these should be reviewed ALL TOGETHER as we fix docs"
)
class TestDocsSnippets(PyScriptTest):
@skip_worker("FIXME: js.document")
def test_tutorials_py_click(self):