Files
pyscript/pyscriptjs/tests/py-unit/conftest.py
Hood Chatham c886f887ae Split pyscript into multiple files (#1338)
In the future this should help us leak fewer names into the pyscript
namespace.

Rather than assigning to the pyscript module from JavaScript, we
mount a separate private JS module with the extra names needed by
PyScript. I moved a bit more interpeter intialization into
remote_interpreter.

I added a deprecation warning for `pyscript.js`: the proper way to
access `js` is `import js`.

---------

Co-authored-by: Antonio Cuni <anto.cuni@gmail.com>
2023-04-12 14:49:47 +02:00

30 lines
805 B
Python

"""All data required for testing examples"""
import sys
from pathlib import Path
import pytest
pyscriptjs = Path(__file__).parents[2]
# add pyscript folder to path
python_source = pyscriptjs / "src" / "python"
sys.path.append(str(python_source))
# add Python plugins folder to path
python_plugins_source = pyscriptjs / "src" / "plugins" / "python"
sys.path.append(str(python_plugins_source))
# patch pyscript module where needed
import pyscript_plugins_tester as ppt # noqa: E402
from pyscript import _plugin # noqa: E402
_plugin.define_custom_element = ppt.define_custom_element
@pytest.fixture()
def plugins_manager():
"""return a new instance of a Test version the PyScript application plugins manager"""
yield ppt.plugins_manager # PluginsManager()
ppt.plugins_manager.reset()