Skip to content

Conversation

@juj
Copy link
Collaborator

@juj juj commented Sep 17, 2025

Make sockets suite more graceful to fail with user facing instructions, and add env. var. EMTEST_LACKS_PYTHON_WEBSOCKIFY=1 to allow testing in shipping configuration.

juj added 3 commits September 17, 2025 14:48
…s, and add env. var. EMTEST_LACKS_PYTHON_WEBSOCKIFY=1 to allow testing in shipping configuration.
@juj juj force-pushed the requires_python_websockify branch from ba03ffb to 5f07bd4 Compare September 17, 2025 11:48

npm_checked = False

EMTEST_LACKS_PYTHON_WEBSOCKIFY = int(os.getenv('EMTEST_LACKS_PYTHON_WEBSOCKIFY', '0'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC we decided its fine to the test suite to require pip install -r requirements-dev.txt?

In that case, I don't think we need this opt out? (same for psutil change you are working on, right?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same for psutil change you are working on, right?)

psutil is currently installed for all users as a runtime dependency, and not just as a dev dependency.

websockify is not being shipped as a end user dependency.

I am testing the suites in end user configuration to ensure that nothing slips through the cracks that would require a dev dependency. So I want to skip all these tests (even though it does reduce coverage - that is ok for me)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in that case perhaps we can re-use the existing requires_dev_dependency decorator and rename the corresponding env var from EMTEST_SKIP_NODE_DEV_PACKAGES to EMTEST_NO_DEV_PACKAGES?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long run I wonder if we can perhaps try to find a way to run these extra tests without accidentally allowing emscripten itself to use these packages?

Perhaps we could find a way to force emscripten itself to use a hermetic python and node that doesn't have visibility of the dev packages (we could ever assert in emscripten itself that these packages are not visible). ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in that case perhaps we can re-use the existing requires_dev_dependency decorator and rename the corresponding env var from EMTEST_SKIP_NODE_DEV_PACKAGES to EMTEST_NO_DEV_PACKAGES?

Hmm, I'm not feeling so hot about that, I find this more documentative - distinguishing between node vs python packages is useful to find "the lay of the land", and also because the steps to install the dependencies are different (invoke npm install vs invoke pip install)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but maybe at least use a single one for all python dev packages (like we do for node packages today).

Copy link
Collaborator Author

@juj juj Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ok, maybe EMTEST_SKIP_PYTHON_DEV_PACKAGES then? Updated.

try:
import websockify # type: ignore
except ModuleNotFoundError:
raise Exception('Unable to import module websockify. Run "python3 -m pip install websockify" or set environment variable EMTEST_LACKS_PYTHON_WEBSOCKIFY=1 to skip this test.') from None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about from None does that make the error easier to read?

Would exit_with_error() make it even more easy to ready in that case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the from None does make the error easier to read.

exit_with_error() would stop the whole harness from running.

@juj juj merged commit 406505c into emscripten-core:main Sep 17, 2025
26 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants