shrinkray: init at 25.9.1-unstable-2025-09-11
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -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";
|
||||
};
|
||||
}
|
||||
@@ -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(
|
||||
Reference in New Issue
Block a user