tests.nixpkgs-check-by-name: Test for gradual transition
This implements the ability to test gradual transitions in check strictness, and adds one such test for the empty non-auto-called arguments check.
This commit is contained in:
parent
d487a975cc
commit
bb08bfc2d3
9 changed files with 22 additions and 1 deletions
|
@ -81,6 +81,10 @@ Tests are declared in [`./tests`](./tests) as subdirectories imitating Nixpkgs w
|
|||
allowing the simulation of package overrides to the real [`pkgs/top-level/all-packages.nix`](../../top-level/all-packages.nix`).
|
||||
The default is an empty overlay.
|
||||
|
||||
- `base` (optional):
|
||||
Contains another subdirectory imitating Nixpkgs with potentially any of the above structures.
|
||||
This will be used as the `--base` argument, allowing tests of gradual transitions.
|
||||
|
||||
- `expected` (optional):
|
||||
A file containing the expected standard output.
|
||||
The default is expecting an empty standard output.
|
||||
|
|
|
@ -212,10 +212,17 @@ 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 base_path = path.join("base");
|
||||
let base_nixpkgs = if base_path.exists() {
|
||||
Some(base_path.as_path())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// 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(None, &path, &vec![&extra_nix_path], &mut writer)
|
||||
process(base_nixpkgs, &path, &vec![&extra_nix_path], &mut writer)
|
||||
.context(format!("Failed test case {name}"))?;
|
||||
Ok(writer)
|
||||
})?;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
self: super: {
|
||||
nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { };
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
self: super: {
|
||||
nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { };
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
import ../../mock-nixpkgs.nix { root = ./.; }
|
|
@ -0,0 +1 @@
|
|||
{ someDrv }: someDrv
|
|
@ -0,0 +1 @@
|
|||
import ../mock-nixpkgs.nix { root = ./.; }
|
|
@ -0,0 +1 @@
|
|||
{ someDrv }: someDrv
|
Loading…
Reference in a new issue