diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-01-10 19:42:02 +0100 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-01-10 19:43:17 +0100 |
commit | d659d5f8acb06ada213dac7c7d87ac20cba15c22 (patch) | |
tree | 38ab4cfcdf037e4679056d8c9c3a6ade4f1daba7 /pkgs/test | |
parent | cbff02834f3c0a1daa3502566fcf19433f9ca214 (diff) | |
download | nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar.gz nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar.bz2 nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar.lz nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar.xz nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.tar.zst nixlib-d659d5f8acb06ada213dac7c7d87ac20cba15c22.zip |
tests.nixpkgs-check-by-name: Use real lib for tests
This way we can also detect regressions caused by lib
Diffstat (limited to 'pkgs/test')
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/src/main.rs | 6 | ||||
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix | 20 |
2 files changed, 5 insertions, 21 deletions
diff --git a/pkgs/test/nixpkgs-check-by-name/src/main.rs b/pkgs/test/nixpkgs-check-by-name/src/main.rs index d7627acb5fee..62ae159df35c 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/main.rs +++ b/pkgs/test/nixpkgs-check-by-name/src/main.rs @@ -226,7 +226,9 @@ mod tests { } fn test_nixpkgs(name: &str, path: &Path, expected_errors: &str) -> anyhow::Result<()> { - let extra_nix_path = Path::new("tests/mock-nixpkgs.nix"); + let mock_nixpkgs_path = Path::new("tests/mock-nixpkgs.nix"); + let real_lib_path = Path::new("../../../lib"); + let extra_nix_path = [mock_nixpkgs_path, real_lib_path]; let base_path = path.join("base"); let base_nixpkgs = if base_path.exists() { @@ -238,7 +240,7 @@ mod tests { // We don't want coloring to mess up the tests let writer = temp_env::with_var("NO_COLOR", Some("1"), || -> anyhow::Result<_> { let mut writer = vec![]; - process(base_nixpkgs, &path, &[&extra_nix_path], &mut writer) + process(base_nixpkgs, &path, &extra_nix_path, &mut writer) .with_context(|| format!("Failed test case {name}"))?; Ok(writer) })?; diff --git a/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix b/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix index cb8066062cc6..2f4657bafe52 100644 --- a/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix +++ b/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix @@ -25,25 +25,7 @@ It returns a Nixpkgs-like function that can be auto-called and evaluates to an a let # Simplified versions of lib functions - lib = { - fix = f: let x = f x; in x; - - extends = overlay: f: final: - let - prev = f final; - in - prev // overlay final prev; - - callPackageWith = autoArgs: fn: args: - let - f = if builtins.isFunction fn then fn else import fn; - fargs = builtins.functionArgs f; - allArgs = builtins.intersectAttrs fargs autoArgs // args; - in - f allArgs; - - isDerivation = value: value.type or null == "derivation"; - }; + lib = import ../../../../lib; # The base fixed-point function to populate the resulting attribute set pkgsFun = self: { |