mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
tests.nixpkgs-check-by-name: Use real lib for tests
This way we can also detect regressions caused by lib
This commit is contained in:
parent
cbff02834f
commit
d659d5f8ac
@ -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)
|
||||
})?;
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user