Commit 73fb7b05 authored by nicoo's avatar nicoo
Browse files

python3Packages.homf: add checks

parent f9fbeb4d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  callPackage,
  fetchFromGitHub,
  # pytestCheckHook,
  pythonOlder,
  versionCheckHook,

  hatchling,
  packaging,
@@ -25,7 +27,6 @@ buildPythonPackage rec {
  build-system = [ hatchling ];

  pythonRelaxDeps = [ "packaging" ];

  dependencies = [ packaging ];

  pythonImportsCheck = [
@@ -39,6 +40,11 @@ buildPythonPackage rec {
  # nativeCheckInputs = [ pytestCheckHook ];
  # pytestFlagsArray = [ "-m 'not network'" ];

  nativeBuildInputs = [ versionCheckHook ];

  # (Ab)using `callPackage` as a fix-point operator, so tests can use the `homf` drv
  passthru.tests = callPackage ./tests.nix { };

  meta = with lib; {
    description = "Asset download tool for GitHub Releases, PyPi, etc.";
    mainProgram = "homf";
+43 −0
Original line number Diff line number Diff line
{
  lib,
  runCommand,
  testers,

  cacert,
  homf,
}:
let
  # runs homf, putting the fetched artefacts in the drv output
  Homf =
    subcommand:
    {
      pkgName,
      version,
      hash,
    }:
    # testers.runCommand ensures we have an FOD, so the command has network access,
    #  yet the test is rerun whenever one of its inputs changes.
    testers.runCommand {
      name = "homf-${subcommand}-${pkgName}";
      script = "homf ${subcommand} --directory $out ${pkgName} ${version}";
      nativeBuildInputs = [
        cacert
        homf
      ];
      inherit hash;
    };
in

lib.mapAttrs Homf {
  pypi = {
    pkgName = "homf";
    version = "1.1.1"; # pinned so updating homf won't invalidate hashes
    hash = "sha256-zpdt7+zTaGkLG6xYoTZVw/kUek0/MrCqvljfLxNB94A=";
  };

  github = {
    pkgName = "duckinator/homf";
    version = "v1.1.1";
    hash = "sha256-NeEz8wZqDWYUnrgsknXWHzhWdk8cPW8mknKS3+/dngQ=";
  };
}