-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
tests/nixpkgs: move nixpkgs module test to dedicated drv #2740
Conversation
FYI #2738 is kinda blocked on this. Or at least blocked on deciding whether we will merge this. I'd like to re-write the tests in that PR based on this PR. |
I'd be in favour of introducing in this PR the framework for tests that don't launch nvim, it can be useful to add tests for assertions or warnings (#2751 reminded me that I wanted to add a diagnostic & such a test) |
That's still on my radar, but I don't see how it relates to this PR |
Those tests don't require to launch nvim, so I guess what I am mostly saying is that it would be nice to create in this PR a test suite that does not eval nvim, and allows to easily add tests to it |
Ok, now that we've tackled negative tests can we revisit this PR and discuss whether we will merge it or something like it? While we could set IDK how performance intensive instantiating an instance of nixpkgs is, or how well nix is able to cache similar instances for re-use... Given the sheer number of test case modules we have, I feel it's probably a good idea to explicitly use the same If so, that means keeping the nixpkgs module tests separate, as per this PR (or similar). |
Yeah it addresses my comment, so I have no idea about the performance though :/ |
This comment was marked as outdated.
This comment was marked as outdated.
f69c1b8
to
7cf4182
Compare
This should be separate from `test-sources` because we want to re-use a common instance of nixpkgs throughout those tests. Also, moved the existing nixpkgs module test from `test-sources`. This partially reverts commit c4ad4d0.
7cf4182
to
5b068e7
Compare
I've re-worked this PR with a much nicer implementation. It still achieves the same separation, but is much cleaner by using |
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.
Indeed, much cleaner!
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 5b068e7 |
This pull request, with head sha This pull request will be automatically closed by GitHub.As soon as GitHub detects that the sha It is possible for this pull request to remain open if this detection does not happen, this usually happens when a force-push is done on this branch |
Thanks @MattSturgeon ! |
We don't need a full test that actually builds or runs nixvim. All we need is some assertions on the result of a nixvim configuration.
Currently #2738 needs to change the module tests to construct their own
pkgs
instance, so that we can test how the module behaves. However this is likely to have a performance hit since we are repeatedly instanciatingpkgs
again for each test case. It's probably better to use a singlepkgs
instance for all test case modules, but move the nixpkgs-module tests to their own dedicated test derivation.This PR does that, moving the existing tests to a dedicated link-farm.
This also allows creating some bespoke helpers to streamline writing the tests and may improve performance slightly because we don't need to also build
config.build.package
for the nixpkgs-module unit tests.The bespoke helpers are a little cumbersome, so I'm open to feedback on them. Some of them may also be useful more generally, so may be worth moving to some kinda "test utils" file. This can be done now or later.