diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index e770c8763d83..7f1a681186f9 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -411,6 +411,7 @@ in xterm = handleTest ./xterm.nix {}; yabar = handleTest ./yabar.nix {}; yggdrasil = handleTest ./yggdrasil.nix {}; + yq = handleTest ./yq.nix {}; zfs = handleTest ./zfs.nix {}; zigbee2mqtt = handleTest ./zigbee2mqtt.nix {}; zoneminder = handleTest ./zoneminder.nix {}; diff --git a/nixos/tests/yq.nix b/nixos/tests/yq.nix new file mode 100644 index 000000000000..7c0e8e3d055a --- /dev/null +++ b/nixos/tests/yq.nix @@ -0,0 +1,12 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "yq"; + meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ nequissimus ]; }; + + nodes.yq = { pkgs, ... }: { environment.systemPackages = with pkgs; [ jq yq ]; }; + + testScript = '' + assert "hello:\n foo: bar\n" in yq.succeed( + 'echo \'{"hello":{"foo":"bar"}}\' | yq -y .' + ) + ''; +}) diff --git a/pkgs/development/python-modules/yq/default.nix b/pkgs/development/python-modules/yq/default.nix index b3e651fd2b0e..9f54dba8b902 100644 --- a/pkgs/development/python-modules/yq/default.nix +++ b/pkgs/development/python-modules/yq/default.nix @@ -1,4 +1,5 @@ { lib +, nixosTests , buildPythonPackage , fetchPypi , pkgs @@ -46,6 +47,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "yq" ]; + passthru.tests = { inherit (nixosTests) yq; }; + meta = with lib; { description = "Command-line YAML processor - jq wrapper for YAML documents"; homepage = "https://github.com/kislyuk/yq";