1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 pythonAtLeast, 6 setuptools, 7 pytest_7, 8 cram, 9 bash, 10}: 11 12buildPythonPackage rec { 13 pname = "pytest-cram"; 14 version = "0.2.2"; 15 pyproject = true; 16 17 # relies on the imp module 18 disabled = pythonAtLeast "3.12"; 19 20 src = fetchPypi { 21 inherit pname version; 22 sha256 = "0405ymmrsv6ii2qhq35nxfjkb402sdb6d13xnk53jql3ybgmiqq0"; 23 extension = "tar.gz"; 24 }; 25 26 postPatch = '' 27 substituteInPlace pytest_cram/tests/test_options.py \ 28 --replace "/bin/bash" "${bash}/bin/bash" 29 ''; 30 31 build-system = [ setuptools ]; 32 33 dependencies = [ cram ]; 34 35 # https://github.com/tbekolay/pytest-cram/issues/15 36 nativeCheckInputs = [ pytest_7 ]; 37 38 # Remove __init__.py from tests folder, otherwise pytest raises an error that 39 # the imported and collected modules are different. 40 checkPhase = '' 41 rm pytest_cram/tests/__init__.py 42 pytest pytest_cram/ --ignore=pytest_cram/tests/test_examples.py 43 ''; 44 45 meta = { 46 description = "Test command-line applications with pytest and cram"; 47 homepage = "https://github.com/tbekolay/pytest-cram"; 48 license = lib.licenses.mit; 49 maintainers = with lib.maintainers; [ jluttine ]; 50 }; 51}