Skip to content

Commit

Permalink
python312Packages.flask-assets: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Aug 22, 2024
1 parent e6e4160 commit 9a21413
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions pkgs/development/python-modules/flask-assets/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
fetchpatch2,
setuptools,
flask,
webassets,
Expand All @@ -13,16 +14,25 @@ buildPythonPackage rec {
version = "2.1.0";
pyproject = true;

src = fetchPypi {
pname = "Flask-Assets";
inherit version;
hash = "sha256-+E1lMv/lnJ/zUoheh0D/TaJcC8+s2AXwqAaBXkQ1SBM=";
src = fetchFromGitHub {
owner = "miracle2k";
repo = "flask-assets";
rev = "refs/tags/${version}";
hash = "sha256-R6cFTT+r/i5j5/QQ+cCFmeuO7SNTiV1F+e0JTxwIUGY=";
};

patchPhase = ''
substituteInPlace tests/test_integration.py --replace 'static_path=' 'static_url_path='
substituteInPlace tests/test_integration.py --replace "static_folder = '/'" "static_folder = '/x'"
substituteInPlace tests/test_integration.py --replace "'/foo'" "'/x/foo'"
patches = [
(fetchpatch2 {
url = "https://github.com/miracle2k/flask-assets/commit/56e06dbb160c165e0289ac97496354786fe3f3fd.patch?full_index=1";
hash = "sha256-Feo7gHHmHtWRB+3XvlECdU4i5rpyjyKEYEUCuy24rf4=";
})
];

postPatch = ''
substituteInPlace tests/test_integration.py \
--replace-fail 'static_path=' 'static_url_path=' \
--replace-fail "static_folder = '/'" "static_folder = '/x'" \
--replace-fail "'/foo'" "'/x/foo'"
'';

nativeBuildInputs = [ setuptools ];
Expand All @@ -32,8 +42,6 @@ buildPythonPackage rec {
webassets
];

doCheck = false; # tests are broken with webassets 2.0

nativeCheckInputs = [ pytestCheckHook ];

pythonImportsCheck = [ "flask_assets" ];
Expand Down

0 comments on commit 9a21413

Please sign in to comment.