-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add a new decorator @requires_npm_package('package-name') #24430
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
Conversation
…sabling tests that require on a specific NPM development package. This allows running the test suite with production-only packages.
Why would we want to run tests without dev dependencies? The packaged version of emscripten probably shouldn't even include the test suite, right? Where-as the developer should always have dev dependencies installer (i.e. via bootstrap). |
To verify that Emscripten works for users who have deployed only the release dependencies. Otherwise we cannot verify that what we ship is something that will work for end users? |
I'm not sure its worth adding yet another test mode for this. Unless you have evidence that this has actually happened or is likely to happen. |
How do you mean "yet another test mode"? Isn't the decorator more like an advertisement/acknowledgement of "this test depends on that feature" - that seems like a convenient way to mark these types of dependencies. Without this PR, if I do
then So currently that gives me no good way of verifying that the Emscripten that I package for Unity users passes all tests, save for starting to manually scribble up notes about which tests are expected to fail, or write a script that allows some failures. That would feel janky. End users won't have the development packages, so I think it would be good to be able to have the test suite reflect on that internally to be able to skip tests that won't be expected to work for end users? That way one can run the test suite in the exact configuration that end users have and it'll verify that no new dev package dependencies were accidentally introduced in Emscripten development? |
What I mean is now we have to have another test configuration called something like
I think its easy enough to simply add I think you are the only person doing the above workflow by the way. As far as I know everyone else who runs the test suite is doing so from a git checkout and running
I don't think we should make it a goal for end users to be able to run the test suite, at least not by default. I don't even think we should be shipping the test suite to end users by default. I'm inclined to say that if you want to run the test suite you need to checkout emscripten using git and run |
test/common.py
Outdated
# Cache which packages have been resolved to avoid individual tests all re-running the same 'npm list' command. | ||
resolved_packages = None | ||
|
||
def require_npm_package(self, package): |
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.
If we do land this can we keep in simple.
No need to run npm maybe? Just a new EMTEST_SKIP_NODE_DEV_DEPENDENCIES
environment variable that skips a certain set of tests.
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'd be OK with landing this much simpler version of this PR.
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 - ok I'll refactor into that form.
Running
I don't want the end users to run the test suite. I want to run the test suite when I am bundling Emscripten, to hold Emscripten team to a guarantee that it has not accidentally added a dependency to a npm package that will not be shipped to end users. Right now there is no way to verify that assumption won't have been violated.
Agreed. I am not shipping the test suite to end users. |
I don't think thats quite how it works. Maybe you are doing
Ok I can get on board with that, but that will mean that we need to add a new test configuration were we run as many tests as we can without the dev dependencies installed. Right now we assume that dev dependencies are installed when running tests since we run all the tests out of a git checkout after installing dev dependnecies. I guess really what we would need to do is run a
|
This change seems to overlap with the existing |
Correct.
If one does
then the starred line will not install dev dependencies, but is a no-op that says "up to date", because
That is not the case. |
Yes, that is to be expected. BTW, does your |
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.
We should probably add a new circle CI config that tests this mode, but it can also be a followup.
LGTM % comments
Yeah, there is some amount of overlap here, though not sure I want to remove that npm_checked in sockets, since it globally checks for all tests in that file (which is convenient for that purpose). |
OK, maybe we can refactor as a followup. |
Currently what we do is 1:1 with emsdk:
Though ideally we will want at some point want to refactor that to do
so we would run tests in such a "make install"ed directory structure, and then remove trail of the test files. |
Ok, now ready for another review round. |
Sadly, one the problems is that out releases builder (and therefore almost all our users) don't install from source using emsdk. We should probably work on unifying the two build processes. At the very least they should probably use the same |
test/common.py
Outdated
@@ -274,6 +274,23 @@ def decorated(self, *args, **kwargs): | |||
return decorated | |||
|
|||
|
|||
# Used to mark dependencies in various tests to npm developer dependency | |||
# packages, which might not be installed on Emscripten end users' systems. | |||
def requires_npm_package(package): |
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.
How about just calling this requires_dev_dependency
?
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.
Works for me. I presume I'd then change the env. var. from EMTEST_SKIP_NODE_DEV_PACKAGES
to EMTEST_SKIP_DEV_PACKAGES
or EMTEST_SKIP_DEV_DEPENDENCIES
?
Add a new decorator
@requires_npm_package('package-name')
to allow disabling tests that require on a specific NPM development package. This allows running the test suite with production-only packages.