This PR re-enables tests on `worker`s. Highlights:
* by default, each test is run twice: the main thread version uses `<script type="py">`, the worker version automatically turn the tags into `<script type="py" worker>`
* you can tweak the settings per-class by using the `@with_execution_thread` decorator. In particular, `@with_execution_thread(None)` is for those tests which don't care about it (e.g., `test_py_config.py`)
* inside each class, there might be some test which should be run only in the main thread (because it doesn't make sense to test it in a worker). For those, I introduced the `@only_main` decorator
* we might introduce `@only_worker` in the future, if needed
* `@skip_worker` is for those tests which currently pass on main but not on workers. These are meant to be temporary, and eventually they should all be fixed
During the process, I tweaked/improved/fixed/deleted some of the existing tests. Some of them were at risk of being flaky and I made them more robust, others depended on some very precise implementation detail, and I made them more generic (for example, `test_image_renders_correctly` relied on pillow to render an image with a very specific string of bytes, and it broke due to the recent upgrade to pyodide 0.24.1)
I also renamed all the skip messages to start with `NEXT`, so that they are easier to grep.
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.
* move integration tests pyscriptjs/tests/integration ->pyscript.core/tests/integration
* add information in regards to how to run integration tests to README
* fix fake server build paths
* fix paths to build and run tests. The change of path before integration tests is a glitch maybe due to pytest cache?
* remove test files created by mistake
* update readme with latest changes
---------
Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
* add pyweb
* build
* add test file
* fix pydom example code
* remove old reference to js
* temporarily comment out query functions on BaseElement while rearranging code to reuse the same underlying logic accross PyDom and other elements
* add temp TODO comment to content as it breaks with template elements
* update pydom example to define code on external file
* fix name type while renaming document -> dom
* add real pydom test files
* add classes to dom scope
* __len__ to ElementCollection
* fix some of the old tests
* rename test from test_query_by_class to test_getitem_by_class
* change test for read and write multiple elements
* add find method to BaseElement
* fix remaining tests
* add Collection Tests
* add equality to Collection
* add test for collection style manipulation
* fix getter for style property and rename style related attribute from pop to remove
* add single element creation test
* remove append on BaseElement and add body and head to dom
* add test_create_element_child to verify child creation
* add children getter property to Element
* remove old code
* remove more old code, change style attribute from visibility to visible and now default getters on collection to return a list with the value of an attribute for every element in the collection
* remove more old code and add possibility to customize test flags via url
* add support to pass Js and pydom.Element elements to when decorator
* remove methods related to input type of elements until we have a better design for it
* rename _element to _js
* add test_when decorator with a ElementCollection input
* when decorator now supporte pydom.ElementCollection as input
* update pyscript.js
* remove useless variable from when decorator
* remove base.py from pyweb
* add nodes for append collection test and add better feedback on successes vs failure
* add tests and fix code for support of append Element and ElementCollection
* manage access to content attribute when tagname is template
* fix comment
---------
Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
* restore HTML code in display module
* restore when decorator code in event_handling module
* add when and HTML at pyscript import level
* add test for display with HTML
* add quick manual test for when
---------
Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
* 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>