From 726f43db16fcd3c24cf5d8f81036cc669afc8570 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 27 Mar 2025 17:15:34 +0100 Subject: [PATCH 1/3] python312Packages.attrs-strict: use `fetchFromGitHub` instead of `fetchPypi` --- .../python-modules/attrs-strict/default.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/attrs-strict/default.nix b/pkgs/development/python-modules/attrs-strict/default.nix index 8f3e9a8548df..7657c8b72abb 100644 --- a/pkgs/development/python-modules/attrs-strict/default.nix +++ b/pkgs/development/python-modules/attrs-strict/default.nix @@ -1,10 +1,11 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, attrs, setuptools, setuptools-scm, + pytestCheckHook, }: buildPythonPackage rec { @@ -12,10 +13,11 @@ buildPythonPackage rec { version = "1.0.1"; pyproject = true; - src = fetchPypi { - inherit version; - pname = "attrs_strict"; - hash = "sha256-5wSGNiAUbF8qi2Ac1FdNFIkT2yb8Bjb5Qf5CEuQl6v4="; + src = fetchFromGitHub { + owner = "bloomberg"; + repo = "attrs-strict"; + tag = version; + hash = "sha256-dDOD4Y57E+i8D0S4q+C6t7zjBTsS8q2UFiS22Dsp0Z8="; }; build-system = [ @@ -29,8 +31,9 @@ buildPythonPackage rec { pythonImportsCheck = [ "attrs_strict" ]; - # No tests in the pypi archive - doCheck = false; + nativeCheckInputs = [ + pytestCheckHook + ]; meta = { changelog = "https://github.com/bloomberg/attrs-strict/releases/tag/${version}"; From 2bf5c5a27aebd72f4cbebaa9ef20f2d0a25d7b43 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 27 Mar 2025 18:25:23 +0100 Subject: [PATCH 2/3] python312Packages.aiohttp-utils: init at 3.2.1 --- .../python-modules/aiohttp-utils/default.nix | 58 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 60 insertions(+) create mode 100644 pkgs/development/python-modules/aiohttp-utils/default.nix diff --git a/pkgs/development/python-modules/aiohttp-utils/default.nix b/pkgs/development/python-modules/aiohttp-utils/default.nix new file mode 100644 index 000000000000..1420606516c3 --- /dev/null +++ b/pkgs/development/python-modules/aiohttp-utils/default.nix @@ -0,0 +1,58 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + aiohttp, + python-mimeparse, + gunicorn, + mako, + pytestCheckHook, + webtest-aiohttp, +}: + +buildPythonPackage rec { + pname = "aiohttp-utils"; + version = "3.2.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "sloria"; + repo = "aiohttp-utils"; + tag = version; + hash = "sha256-CGKka6nGQ9o4wn6o3YJ3hm8jGbg16NKkCdBA1mKz4bo="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + aiohttp + python-mimeparse + gunicorn + ]; + + pythonImportsCheck = [ + "aiohttp_utils" + ]; + + nativeCheckInputs = [ + mako + pytestCheckHook + webtest-aiohttp + ]; + + disabledTests = [ + # AssertionError: assert None == 'application/octet-stream' + "test_renders_to_json_by_default" + ]; + + meta = { + description = "Handy utilities for building aiohttp.web applications"; + homepage = "https://github.com/sloria/aiohttp-utils"; + changelog = "https://github.com/sloria/aiohttp-utils/blob/${src.rev}/CHANGELOG.rst"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 84089eace07f..51f5d796cd05 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -314,6 +314,8 @@ self: super: with self; { aiohttp-swagger = callPackage ../development/python-modules/aiohttp-swagger { }; + aiohttp-utils = callPackage ../development/python-modules/aiohttp-utils { }; + aiohttp-wsgi = callPackage ../development/python-modules/aiohttp-wsgi { }; aiohue = callPackage ../development/python-modules/aiohue { }; From 8ca2920313747d797bd8f99638ec93ea04894f38 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 27 Mar 2025 17:16:01 +0100 Subject: [PATCH 3/3] python312Packages.swh-core: enable `systemd` tests --- .../python-modules/swh-core/default.nix | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/pkgs/development/python-modules/swh-core/default.nix b/pkgs/development/python-modules/swh-core/default.nix index b3ff2d4ac851..aa0ca05d0318 100644 --- a/pkgs/development/python-modules/swh-core/default.nix +++ b/pkgs/development/python-modules/swh-core/default.nix @@ -13,11 +13,14 @@ tenacity, setuptools, setuptools-scm, + aiohttp-utils, flask, hypothesis, iso8601, lzip, msgpack, + postgresql, + postgresqlTestHook, psycopg, pylzma, pytestCheckHook, @@ -26,6 +29,7 @@ pytest-postgresql, pytz, requests-mock, + systemd, types-deprecated, types-psycopg2, types-pytz, @@ -70,12 +74,15 @@ buildPythonPackage rec { __darwinAllowLocalNetworking = true; nativeCheckInputs = [ + aiohttp-utils flask hypothesis iso8601 lzip msgpack - psycopg + postgresql + postgresqlTestHook + psycopg.optional-dependencies.pool pylzma pytestCheckHook pytest-aiohttp @@ -83,6 +90,7 @@ buildPythonPackage rec { pytest-postgresql pytz requests-mock + systemd types-deprecated types-psycopg2 types-pytz @@ -92,29 +100,14 @@ buildPythonPackage rec { pkgs.zstd ]; - disabledTests = - [ - # ValueError: Unable to configure handler 'systemd' - "test_logging_configure_from_yaml" - ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ - # FileExistsError: [Errno 17] File exists: - "test_uncompress_upper_archive_extension" - # AssertionError: |500 - 632.1152460000121| not within 100 - "test_timed_coroutine" - "test_timed_start_stop_calls" - "test_timed" - "test_timed_no_metric" - ]; - - disabledTestPaths = [ - # ModuleNotFoundError: No module named 'aiohttp_utils' - "swh/core/api/tests/test_async.py" - "swh/core/api/tests/test_rpc_server_asynchronous.py" - # ModuleNotFoundError: No module named 'systemd' - "swh/core/tests/test_logger.py" - # ModuleNotFoundError: No module named 'psycopg_pool' - "swh/core/db/tests" + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ + # FileExistsError: [Errno 17] File exists: + "test_uncompress_upper_archive_extension" + # AssertionError: |500 - 632.1152460000121| not within 100 + "test_timed_coroutine" + "test_timed_start_stop_calls" + "test_timed" + "test_timed_no_metric" ]; meta = {