From 648eece4bfb5a3360bed16670a7cf36e2169f07e Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Fri, 18 Dec 2020 12:07:30 -0500 Subject: [PATCH] yq: Add test --- nixos/tests/all-tests.nix | 1 + nixos/tests/yq.nix | 12 ++++++++++++ pkgs/development/python-modules/yq/default.nix | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 nixos/tests/yq.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index e770c8763d8..7f1a681186f 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 00000000000..7c0e8e3d055 --- /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 b3e651fd2b0..9f54dba8b90 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";