summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/contexttimer/default.nix
blob: 987339bc9922d73642ec745309a1c0f190a1df2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  setuptools,
  mock,
  pytestCheckHook,
}:

buildPythonPackage {
  pname = "contexttimer";
  version = "unstable-2024-09-05";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "brouberol";
    repo = "contexttimer";
    rev = "8e77927b8b75365f8e2bc456d2457b3e47c67815";
    hash = "sha256-LCyXJa+7XkfxzcLGonv1yfOW+gZhLFBAbBT+5IP39qA=";
  };

  disabled = pythonOlder "3.12";

  build-system = [ setuptools ];

  preCheck = ''
    substituteInPlace tests/test_timer.py \
      --replace-fail "assertRegexpMatches" "assertRegex"
  '';

  nativeCheckInputs = [
    mock
    pytestCheckHook
  ];

  pythonImportsCheck = [ "contexttimer" ];

  meta = {
    homepage = "https://github.com/brouberol/contexttimer";
    description = "Timer as a context manager";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ atila ];
  };
}