Skip to content

Commit 2abefa3

Browse files
committed
flake-modules/tests: introduce callTest(s) auto-arg helpers
Allows using the `callPackage(s)` pattern on tests. For now, just migrate the existing `pkgs.callPackage` usage.
1 parent 27ea397 commit 2abefa3

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

tests/default.nix

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,23 @@
88
self, # The flake instance
99
}:
1010
let
11-
inherit (self.legacyPackages.${system}) nixvimConfiguration;
11+
autoArgs = pkgs // {
12+
inherit
13+
helpers
14+
lib
15+
makeNixvimWithModule
16+
pkgsUnfree
17+
self
18+
system
19+
;
20+
inherit (self.legacyPackages.${system}) nixvimConfiguration;
21+
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
22+
# Recursive:
23+
inherit callTest callTests;
24+
};
25+
26+
callTest = lib.callPackageWith autoArgs;
27+
callTests = lib.callPackagesWith autoArgs;
1228
in
1329
{
1430
extra-args-tests = import ./extra-args.nix {
@@ -21,9 +37,7 @@ in
2137
inherit pkgs makeNixvimWithModule;
2238
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
2339
};
24-
failing-tests = pkgs.callPackage ./failing-tests.nix {
25-
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
26-
};
40+
failing-tests = callTest ./failing-tests.nix { };
2741
no-flake = import ./no-flake.nix {
2842
inherit system;
2943
inherit (self.lib.${system}.check) mkTestDerivationFromNvim;
@@ -34,10 +48,10 @@ in
3448
inherit (pkgs) lib;
3549
};
3650
maintainers = import ./maintainers.nix { inherit pkgs; };
37-
plugins-by-name = pkgs.callPackage ./plugins-by-name.nix { inherit nixvimConfiguration; };
38-
generated = pkgs.callPackage ./generated.nix { };
39-
package-options = pkgs.callPackage ./package-options.nix { inherit nixvimConfiguration; };
40-
lsp-all-servers = pkgs.callPackage ./lsp-servers.nix { inherit nixvimConfiguration; };
51+
plugins-by-name = callTest ./plugins-by-name.nix { };
52+
generated = callTest ./generated.nix { };
53+
package-options = callTest ./package-options.nix { };
54+
lsp-all-servers = callTest ./lsp-servers.nix { };
4155
}
4256
# Tests generated from ./test-sources
4357
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }

0 commit comments

Comments
 (0)