move "nix build" to tests/common

This commit is contained in:
cy 2025-04-28 21:39:14 -04:00
parent 76cbc85032
commit 05589641cf
2 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,6 @@
#![allow(dead_code)]
use std::process::Command;
use std::sync::Arc;
use nixcp::store::Store;
@ -14,6 +15,13 @@ pub struct Context {
impl Context {
fn new() -> Self {
// hello must be in the store
Command::new("nix")
.arg("build")
.arg("--no-link")
.arg(HELLO)
.status()
.unwrap();
let store = Arc::new(Store::connect().expect("connect to nix store"));
Self { store }
}

View file

@ -1,6 +1,5 @@
use nixcp::path_info::PathInfo;
use std::path::PathBuf;
use std::process::Command;
use crate::common::{HELLO, HELLO_DRV, HELLO_PATH};
@ -18,13 +17,6 @@ async fn path_info_from_package() {
#[tokio::test]
async fn path_info_from_path() {
// the path must be in the store
Command::new("nix")
.arg("build")
.arg("--no-link")
.arg(HELLO)
.status()
.unwrap();
let ctx = common::context();
let path = PathBuf::from(HELLO_PATH);
let path_info = PathInfo::from_derivation(&path, &ctx.store)