tests: migrate structured-attrs.sh
Change-Id: I6d2b82e3aa236d01b9a345c148b7fef3703a446d
This commit is contained in:
@@ -82,7 +82,6 @@ functional_tests_scripts = [
|
||||
'linux-sandbox.sh',
|
||||
'supplementary-groups.sh',
|
||||
'build-dry.sh',
|
||||
'structured-attrs.sh',
|
||||
'shell.sh',
|
||||
'nix-copy-ssh.sh',
|
||||
'nix-copy-ssh-ng.sh',
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
rm -f $TEST_ROOT/result
|
||||
|
||||
nix-build structured-attrs.nix -A all -o $TEST_ROOT/result
|
||||
|
||||
[[ $(cat $TEST_ROOT/result/foo) = bar ]]
|
||||
[[ $(cat $TEST_ROOT/result-dev/foo) = foo ]]
|
||||
@@ -1,3 +1,7 @@
|
||||
from pathlib import Path
|
||||
from testlib.fixtures.file_helper import CopyFile
|
||||
from testlib.fixtures.file_helper import with_files
|
||||
from testlib.utils import get_global_asset
|
||||
from testlib.fixtures.nix import Nix
|
||||
|
||||
|
||||
@@ -17,3 +21,17 @@ evil_drv = """
|
||||
def test_improper_structured_attrs_drv(nix: Nix):
|
||||
result = nix.nix_build(["--expr", evil_drv]).run().expect(1)
|
||||
assert "a `__json` attribute cannot be passed" in result.stderr_s
|
||||
|
||||
|
||||
@with_files(
|
||||
{
|
||||
"structured-attrs.nix": CopyFile("assets/structured-attrs.nix"),
|
||||
"config.nix": get_global_asset("config.nix"),
|
||||
}
|
||||
)
|
||||
def test_proper_structured_attrs(nix: Nix, files: Path):
|
||||
result = files / "result"
|
||||
nix.nix_build(["structured-attrs.nix", "-A", "all", "-o", result]).run().ok()
|
||||
|
||||
assert (result / "foo").read_text() == "bar\n"
|
||||
assert (files / "result-dev" / "foo").read_text() == "foo\n"
|
||||
|
||||
Reference in New Issue
Block a user