* blacked
* More robust code for display, with tests
Display now includes more robust controls when checking
the input target parameters, with appropriate exception raised
(i.e. ValueError or TypeError) whether target is either
an empty string, or a not-string, not-None type, respectively.
The TypeError aligns with other similar behaviour with other Pyton
functions (e.g. str.split with integer separator).
Also, now display raises a ValueError whether the target element
is not found or not existing.
All changes are supported by tests.
* traceback lines in check_py_error & removed clones
check_py_error function now automatically includes
check of the traceback in console errors.
This way tests in basic and display have been refactored,
and lots of duplicated code removed.
* removed useless console check lines.
If check_py_errors function is running, those
console log lines are useless to check.
This re-enables CI tests on every PR 🎉.
This uses make test-integration, which runs tests sequentially.
In theory, we also have test-integration-parallel but it seems to be very flaky: many tests randomly timeout. I didn't spend too much time investigating this, it's probably worth its own investigation in a separate PR, but for now it's important to re-enable CI tests, even if they are a bit slower.
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>