nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

python3.pkgs.msprime: use pytestCheckHook

Instead of manually specifying the disabled tests and test paths in
`checkPhase`, use the pytestCheckHook for that, and avoid the issue
described at https://github.com/NixOS/nixpkgs/issues/255262 by removing
the source directory.

+19 -23
+19 -23
pkgs/development/python-modules/msprime/default.nix
··· 10 10 , newick 11 11 , tskit 12 12 , demes 13 - , pytest 13 + , pytestCheckHook 14 14 , pytest-xdist 15 15 , scipy 16 16 }: ··· 45 45 ]; 46 46 47 47 nativeCheckInputs = [ 48 - pytest 48 + pytestCheckHook 49 49 pytest-xdist 50 50 scipy 51 51 ]; 52 + disabledTests = [ 53 + "tests/test_ancestry.py::TestSimulator::test_debug_logging" 54 + "tests/test_ancestry.py::TestSimulator::test_debug_logging_dtw" 55 + ]; 56 + disabledTestPaths = [ 57 + "tests/test_demography.py" 58 + "tests/test_algorithms.py" 59 + "tests/test_provenance.py" 60 + "tests/test_dict_encoding.py" 61 + ]; 52 62 53 - checkPhase = '' 54 - runHook preCheck 55 - 56 - # avoid adding the current directory to sys.path 57 - # https://docs.pytest.org/en/7.1.x/explanation/pythonpath.html#invoking-pytest-versus-python-m-pytest 58 - # need pythonPackages.stdpopsim 59 - # need pythonPackages.bintrees 60 - # need pythonPachages.python_jsonschema_objects 61 - # ModuleNotFoundError: No module named 'lwt_interface.dict_encoding_testlib' 62 - # fails for python311 63 - # fails for python311 64 - pytest -v --import-mode append \ 65 - --ignore=tests/test_demography.py \ 66 - --ignore=tests/test_algorithms.py \ 67 - --ignore=tests/test_provenance.py \ 68 - --ignore=tests/test_dict_encoding.py \ 69 - --deselect=tests/test_ancestry.py::TestSimulator::test_debug_logging \ 70 - --deselect=tests/test_ancestry.py::TestSimulator::test_debug_logging_dtwf 71 - 72 - runHook postCheck 63 + # `python -m pytest` puts $PWD in sys.path, which causes the extension 64 + # modules imported as `msprime._msprime` to be unavailable, failing the 65 + # tests. This deletes the `msprime` folder such that only what's installed in 66 + # $out is used for the imports. See also discussion at: 67 + # https://github.com/NixOS/nixpkgs/issues/255262 68 + preCheck = '' 69 + rm -r msprime 73 70 ''; 74 - 75 71 pythonImportsCheck = [ 76 72 "msprime" 77 73 ];