From e78b664b4fdd0ede5e565e4dec4da8c6e1591b6c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 23 Oct 2025 16:04:05 -0700 Subject: [PATCH] shrinkray: init at 25.9.1-unstable-2025-09-11 Signed-off-by: Anders Kaseorg --- pkgs/by-name/sh/shrinkray/package.nix | 54 +++++++++++++++++++ .../sh/shrinkray/tests-remove-black.patch | 34 ++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 pkgs/by-name/sh/shrinkray/package.nix create mode 100644 pkgs/by-name/sh/shrinkray/tests-remove-black.patch diff --git a/pkgs/by-name/sh/shrinkray/package.nix b/pkgs/by-name/sh/shrinkray/package.nix new file mode 100644 index 000000000000..f2fda3fa9453 --- /dev/null +++ b/pkgs/by-name/sh/shrinkray/package.nix @@ -0,0 +1,54 @@ +{ + coreutils, + creduce, + fetchFromGitHub, + lib, + python3, +}: + +python3.pkgs.buildPythonApplication { + pname = "shrinkray"; + version = "25.9.1-unstable-2025-09-11"; + pyproject = true; + + src = fetchFromGitHub { + owner = "DRMacIver"; + repo = "shrinkray"; + rev = "21dac48cdb7f3a375a4ac5e5c782b7d4d3711d36"; + hash = "sha256-ef0vsWfLl0hJ7WfwInh++GAbw3qTZe8RAVNLxQCTNNs="; + }; + patches = [ ./tests-remove-black.patch ]; + postPatch = '' + substituteInPlace tests/test_main.py \ + --replace-fail '/usr/bin/env' '${coreutils}/bin/env' + ''; + + build-system = [ python3.pkgs.setuptools ]; + propagatedBuildInputs = with python3.pkgs; [ + click + chardet + trio + urwid + humanize + libcst + exceptiongroup + binaryornot + ]; + checkInputs = with python3.pkgs; [ + hypothesis + hypothesmith + pytest-trio + pygments + ]; + nativeCheckInputs = with python3.pkgs; [ + pytestCheckHook + ]; + + meta = { + description = "Modern multi-format test-case reducer"; + license = lib.licenses.mit; + homepage = "https://github.com/DRMacIver/shrinkray"; + maintainers = [ lib.maintainers.andersk ]; + mainProgram = "shrinkray"; + }; +} diff --git a/pkgs/by-name/sh/shrinkray/tests-remove-black.patch b/pkgs/by-name/sh/shrinkray/tests-remove-black.patch new file mode 100644 index 000000000000..e680ede055ee --- /dev/null +++ b/pkgs/by-name/sh/shrinkray/tests-remove-black.patch @@ -0,0 +1,34 @@ +diff --git a/tests/test_main.py b/tests/test_main.py +index ec6453e..a219750 100644 +--- a/tests/test_main.py ++++ b/tests/test_main.py +@@ -5,16 +5,11 @@ import pathlib + import pytest + + import trio +-import black + from shrinkray.__main__ import interrupt_wait_and_kill, main + from click.testing import CliRunner + from attrs import define + + +-def format(s): +- return black.format_str(s, mode=black.Mode()).strip() +- +- + async def test_kill_process(): + async with trio.open_nursery() as nursery: + kwargs = dict( +@@ -100,10 +95,8 @@ except AssertionError: + assert not b.exists() + assert c.exists() + +- # TODO: Remove calls to format when formatting is implemented properly for +- # directories. +- assert format(a.read_text()) == "x = 0" +- assert format(c.read_text()) == "from a import x\n\nassert x" ++ assert a.read_text() == "x=0" ++ assert c.read_text() == "from\ta\timport\tx\nassert\tx" + + + def test_gives_informative_error_when_script_does_not_work_outside_current_directory(