This PR tries to improve and rationalize what we log. Key points:
- introduce `logger.ts`: each file/component is encouraged to use the logger instead of writing directly to `console.*`
* the logger automatically prepend a prefix like `[py-config]`, `[py-env]` which make it easier to understand where a certain message is printed from
* it provide a central place where to add more features in the future. E.g., I can imagine having a config setting to completely silence the logs (not implemented yet)
- use the new loggers everywhere
- write to `.info()` instead of `.log()`. The idea is to keep `console.log` free, so that for the users it's easier to tell apart their own messages and the pyscript ones
- generally improve what we log. This is an endless exercise, but I tried to print more things which are useful to understand what's going on and in which order the various things are executed, and remove prints which were clearly debugging leftovers
* add integration test for py-config
* fix bug
* fix test
* remove indexURL altogether
* make jest happy
* fix create_proxy import
* check that py-config loads an older version
* add unit test
* suggested changes
* don't use /tmp because of bandit
* make runtime an object of Runtime class when it is just an object
* fix constructor
* remove explicit string type
* define default values out of pyodide runtime and use default config instead of initializing a DEFAULT_RUNTIME instance
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
* 585: Add a line to the makefile to run the examples on a python server with one line command
* Build exs and run server with previous makefile cmds
Co-authored-by: Todd Keech <tkeech1@hotmail.com>
Co-authored-by: mariana <marianameireles@protonmail.com>
* PyodideRuntime should be one of the runtimes
* subsume interpreter into runtime API
* fix eslint
* add comments
* move initializers, postInitializers, scriptsQueue, etc. to initialize() of Runtime Super Class
* modify comment for initialize
* small renaming
* change id to default
* fix pyscript.py import
* try adding tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add inlineDynamicImports option
* Make jest happy about ESM modules
* Attempt to make jest happy about pyodide
* point to version in accordance with node module being used
* fix base.ts
* fix tests
* fix indexURL path determination
* edit pyodide.asm.js as a part of setup process
* load runtime beforeAll tests
* add test for loading a package
* use only runPythonAsync underneath for pyodide
* import PyodideInterface type directly from pyodide
* add some comments
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
* Add more integration tests for py-components and examples
for more information, see https://pre-commit.ci
* remove xfail mark since we merged fix for issue 707
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
* add build to the make examples cmd so that it automates more to the user
* temporarily improve error managament when executing eval until we properly refactor the whole io and error workflow
* add minimal test for format_mime
* move current integration tests to the integration folder
* move pyscript.py into its own python folder
* change the path for python unit testing files
* change pyscript.py path
* Update Makefile
* remove echo
* replace conda run with pytest directly
* oops, add python test files I embarrassingly forgot to add
Co-authored-by: Peter W <34256109+pww217@users.noreply.github.com>
* install test dependencies
* change config for tests
* fix linter failing tests
* add basic test file
* add custom element registration to test
* update dependencies
* add jest config file
* fix test calls on makefile and minor fix on test
* update local npm version
* clean testm file
* Ensure that angle brackets in pyscript tag are escaped before parsing
* Improve tests
* Update pyscriptjs/tests/test_01_basic.py
Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com>
Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com>
* WIP: start to use the PyScriptTests machinery to test the examples
* factor test_hello_world out of test_examples
* B011 forbids 'assert False' in tests because python -O remove asserts. Thank you, I knew that.
* improve test_simple_clock and remove it from test_examples
* test_altair
* test_bokeh
* rename
* kill the parametrized test_example and write individual tests for each of them
* test_kmeans it's slow, increase the timeout
* improve these xfail
* kill wait_for_load, no longer needed
* write the name of the issue
* add issue number
* add a trick which I discovered to run test interactively
* move the docstring inside the class
This PR is about integration tests: they use playwright to load HTML pages in the browser and check that PyScript works as intended, as opposed to unit tests like the ones being introduced by #665 and #661.
The main goal of this PR is to introduce some machinery to make such tests easier to write, read and maintain, with some attention to capture enough information to produce useful error messages in case they fail in the CI.
In order to use the machinery, you need to subclass tests.support.PyScriptTest, which provides several useful API calls in the form self.xxx().
See the full description here:
https://github.com/pyscript/pyscript/pull/663
Co-authored-by: Mariana Meireles <marian.meireles@gmail.com>
Co-authored-by: mariana <marianameireles@protonmail.com>
* checkpoint: added some text
* checkpoint: added setting up the environment, tips for writing good issues
* continuing to fill it out
* added more detailed description of the process of creating a change and some other cleanup.
* added a getting started section and cleaned up the grammar. This ready for the PR now
* forgot to add the new section to the TOC
* Changes
* Minor fixes
* Minor fixes
* Minor fixes
* Minor fixes
* Minor fixes
* Minor fixes
* Fix
Co-authored-by: Kevin Goldsmith <kgoldsmith@anaconda.com>
Co-authored-by: Matt Kramer <mkramer@anaconda.com>
* fix tests by changing serving dir
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>