From 383f3704160e22957fe18cdde8497000c7d8e5d8 Mon Sep 17 00:00:00 2001 From: Noah Fontes Date: Fri, 16 Sep 2022 09:50:47 -0700 Subject: [PATCH] pythonPackages.cyclonedx-python-lib: fix checkPhase The unit tests for this package require the tests directory to be on the PYTHONPATH. We also can switch to pytest to run most of the TestOutputJson test cases, explicitly disabling the few that require network access. --- .../cyclonedx-python-lib/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/cyclonedx-python-lib/default.nix b/pkgs/development/python-modules/cyclonedx-python-lib/default.nix index 731aef1c647f..7704e7b8d5a4 100644 --- a/pkgs/development/python-modules/cyclonedx-python-lib/default.nix +++ b/pkgs/development/python-modules/cyclonedx-python-lib/default.nix @@ -6,6 +6,7 @@ , lxml , packageurl-python , poetry-core +, pytestCheckHook , python , pythonOlder , requirements-parser @@ -14,7 +15,6 @@ , toml , types-setuptools , types-toml -, unittestCheckHook , xmldiff }: @@ -48,7 +48,7 @@ buildPythonPackage rec { ]; checkInputs = [ - unittestCheckHook + pytestCheckHook jsonschema lxml xmldiff @@ -59,9 +59,17 @@ buildPythonPackage rec { ]; preCheck = '' - rm tests/test_output_json.py + export PYTHONPATH=tests''${PYTHONPATH+:$PYTHONPATH} ''; + pytestFlagsArray = [ "tests/" ]; + + disabledTests = [ + # These tests require network access. + "test_bom_v1_3_with_metadata_component" + "test_bom_v1_4_with_metadata_component" + ]; + meta = with lib; { description = "Python library for generating CycloneDX SBOMs"; homepage = "https://github.com/CycloneDX/cyclonedx-python-lib";