Merge pull request #154914 from fabaff/fix-glom

python3Packages.glom: switch to pytestCheckHook
This commit is contained in:
Fabian Affolter 2022-01-13 20:11:15 +01:00 committed by GitHub
commit 6ee6ba49a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 17 deletions

View file

@ -3,40 +3,53 @@
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, pytestCheckHook , pytestCheckHook
, pythonAtLeast
, pythonOlder
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "boltons"; pname = "boltons";
version = "20.2.1"; version = "20.2.1";
format = "setuptools";
disabled = pythonOlder "3.7";
# No tests in PyPi Tarball
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mahmoud"; owner = "mahmoud";
repo = "boltons"; repo = "boltons";
rev = version; rev = version;
sha256 = "0vw0h0z81gfxgjfijqiza92ic0siv9xy65mklgj5d0dzr1k9waw8"; hash = "sha256-iCueZsi/gVbko7MW43vaUQMWRVI/YhmdfN29gD6AgG8=";
}; };
patches = [ checkInputs = [
pytestCheckHook
];
patches = lib.optionals (pythonAtLeast "3.10") [
# pprint has no attribute _safe_repr, https://github.com/mahmoud/boltons/issues/294
(fetchpatch { (fetchpatch {
url = "https://github.com/mahmoud/boltons/commit/754afddf141ea26956c88c7e13fe5e7ca7942654.patch"; name = "fix-pprint-attribute.patch";
sha256 = "14kcq8pl4pmgcnlnmj1sh1yrksgym0kn0kgz2648g192svqkbpz8"; url = "https://github.com/mahmoud/boltons/commit/270e974975984f662f998c8f6eb0ebebd964de82.patch";
sha256 = "sha256-pZLfr6SRCw2aLwZeYaX7bzfJeZC4cFUILEmnVsKR6zc=";
}) })
]; ];
checkInputs = [ pytestCheckHook ];
disabledTests = [ disabledTests = [
# This test is broken without this PR, which has not yet been merged # This test is broken without this PR. Merged but not released
# https://github.com/mahmoud/boltons/pull/283 # https://github.com/mahmoud/boltons/pull/283
"test_frozendict_ior" "test_frozendict"
];
pythonImportsCheck = [
"boltons"
]; ];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/mahmoud/boltons"; homepage = "https://github.com/mahmoud/boltons";
description = "220+ constructs, recipes, and snippets extending (and relying on nothing but) the Python standard library"; description = "Constructs, recipes, and snippets extending the Python standard library";
longDescription = '' longDescription = ''
Boltons is a set of over 220 BSD-licensed, pure-Python utilities Boltons is a set of over 200 BSD-licensed, pure-Python utilities
in the same spirit as and yet conspicuously missing from the in the same spirit as - and yet conspicuously missing from - the
standard library, including: standard library, including:
- Atomic file saving, bolted on with fileutils - Atomic file saving, bolted on with fileutils

View file

@ -4,24 +4,47 @@
, boltons , boltons
, attrs , attrs
, face , face
, pytest , pytestCheckHook
, pyyaml , pyyaml
, pythonOlder
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "glom"; pname = "glom";
version = "20.11.0"; version = "20.11.0";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "54051072bccc9cdb3ebbd8af0559195137a61d308f04bff19678e4b61350eb12"; hash = "sha256-VAUQcrzMnNs+u9ivBVkZUTemHTCPBL/xlnjkthNQ6xI=";
}; };
propagatedBuildInputs = [ boltons attrs face ]; propagatedBuildInputs = [
boltons
attrs
face
];
checkInputs = [ pytest pyyaml ]; checkInputs = [
pytestCheckHook
pyyaml
];
preCheck = ''
# test_cli.py checks the output of running "glom" # test_cli.py checks the output of running "glom"
checkPhase = "PATH=$out/bin:$PATH pytest glom/test"; export PATH=$out/bin:$PATH
'';
disabledTests = [
# Test is outdated (was made for PyYAML 3.x)
"test_main_yaml_target"
];
pythonImportsCheck = [
"glom"
];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/mahmoud/glom"; homepage = "https://github.com/mahmoud/glom";