-
-
Notifications
You must be signed in to change notification settings - Fork 355
tests: refactor to use callTest(s) pattern + move calls to tests/default.nix
#2433
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
5cb057d to
4c11b44
Compare
Move the previous `default.nix` to `main.nix` so that `default.nix` can be used for defining the set of all test derivations. `main.nix` is imported by `default.nix`, but is only responsible for the tests built from `tests/test-sources/`.
Allows using the `callPackage(s)` pattern on tests. Rather than using `pkgs.callPackage`, we implement our own variant using `lib.callPackageWith`. Our variant (`callTest`) includes additional nixvim-specific stuff commonly used by our tests.
e.g. Prefer taking `pkgs.*` attrs directly as function arguments.
4c11b44 to
036e116
Compare
| @@ -0,0 +1,69 @@ | |||
| # Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations | |||
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.
Is there a better name than main.nix?
main.nixcould be confusing, asdefault.nixis the "main" entrypoint to a directorymodules.nixcould make sense (the file is responsible for making tests from the modules intest-sources), but we already have amodules.nixthat tests the wrapper modules...generated.nixcould make sense too, but we already have agenerated.nixtest that tests the ci-generated files are valid
Maybe modules.nix is the way to go, if we renamed the current modules.nix to wrappers.nix? But this is making the diff much larger than it really should be for a minor refactoring 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.
I agree modules.nix would be better. We can do it in another PR though.
|
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 036e116 |
|
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 |
tests/default.nixcallTestpatterncallTestpatternThis takes ideas from #2104 (reducing the scope of that PR) and is required for #2430, as otherwise the auto-formatting leads to an unnecessarily large diff.
This PR contains two key ideas in its refactoring:
callPackagepattern with a nixvim-specificcallTestvarianttests/default.nix->tests/main.nixsince there are other tests intests/not "owned" bydefault.nixflake-modules/test.nixto a newtests/default.nix, so that we minimize the implementation details contained withinflake-modulesand allowtests/to take responsibility for all its test derivations.