-
-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TST Make pyodide-test-runner
installable
#2742
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! A few more questions otherwise looks good.
The one thing I don't understand is the reason for the changes in test_decorator.py
@@ -202,6 +206,8 @@ jobs: | |||
name: stack-size | |||
command: | | |||
make npm-link | |||
pip install ./pyodide-test-runner | |||
npm install -g node-fetch@2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to install node-fetch? It should already be installed I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node-fetch is installed locally during the installation of pyodide JS package, which means it cannot be accessed unless the js script file (node_test_driver.js
) is located in the subdirectory of Pyodide source tree. In this PR we are installing pyodide-test-runner
to e.g. site-packages, so node-fetch needs to be installed globally.
Maybe we can update the node version in our docker image in a subsequent PR that supports native fetch to remove those duplicated node-fetch installations.
@@ -80,7 +82,7 @@ def selenium_common( | |||
f"Unknown runner or browser: {runner_type} / {request.param}" | |||
) | |||
|
|||
dist_dir = request.config.getoption("--dist-dir") | |||
dist_dir = Path(os.getcwd(), request.config.getoption("--dist-dir")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--dist-dir could also be an absolute path in which case this will not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it works even if --dist-dir
is an absolute path:
>>> Path("/abs1", "/abs2")
PosixPath('/abs2')
@@ -25,8 +24,6 @@ const context = { | |||
TextDecoder: util.TextDecoder, | |||
TextEncoder: util.TextEncoder, | |||
URL, | |||
atob: base64.decode, | |||
btoa: base64.encode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you comment why removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those functions were previously required in run_in_pyodide
decorator, but was removed (#2510).
source : atob({encoded}.join("")), |
@@ -1,83 +1,53 @@ | |||
import asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please comment why we need to refactor this file? Maybe Hood should review this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this to remove all import pyodide
statements. I wanted to make pyodide-test-runner
testable without accessing Pyodide source tree.
Most changes in test_decorator
file are replacing the selenium mock class with a real selenium class which, I guess, does not harm test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
This makes
pyodide-test-runner
a regular installable Python package, instead of hacking withsys.path
.Related issue: #2741