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<()> {
|
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_path = path.join("base");
|
||||||
let base_nixpkgs = if base_path.exists() {
|
let base_nixpkgs = if base_path.exists() {
|
||||||
@ -238,7 +240,7 @@ mod tests {
|
|||||||
// We don't want coloring to mess up the tests
|
// We don't want coloring to mess up the tests
|
||||||
let writer = temp_env::with_var("NO_COLOR", Some("1"), || -> anyhow::Result<_> {
|
let writer = temp_env::with_var("NO_COLOR", Some("1"), || -> anyhow::Result<_> {
|
||||||
let mut writer = vec![];
|
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}"))?;
|
.with_context(|| format!("Failed test case {name}"))?;
|
||||||
Ok(writer)
|
Ok(writer)
|
||||||
})?;
|
})?;
|
||||||
|
@ -25,25 +25,7 @@ It returns a Nixpkgs-like function that can be auto-called and evaluates to an a
|
|||||||
let
|
let
|
||||||
|
|
||||||
# Simplified versions of lib functions
|
# Simplified versions of lib functions
|
||||||
lib = {
|
lib = import ../../../../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";
|
|
||||||
};
|
|
||||||
|
|
||||||
# The base fixed-point function to populate the resulting attribute set
|
# The base fixed-point function to populate the resulting attribute set
|
||||||
pkgsFun = self: {
|
pkgsFun = self: {
|
||||||
|
Loading…
Reference in New Issue
Block a user