From 9ed59a18dcbff50e8703c5d76e66c8b111aa2200 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Tue, 9 Sep 2025 11:03:30 -0700 Subject: [PATCH] python3Packages.mmengine: fix broken tests on Darwin --- .../python-modules/mmengine/default.nix | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkgs/development/python-modules/mmengine/default.nix b/pkgs/development/python-modules/mmengine/default.nix index 52d2ff2a84c7..0217e140b77b 100644 --- a/pkgs/development/python-modules/mmengine/default.nix +++ b/pkgs/development/python-modules/mmengine/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, fetchpatch, @@ -117,6 +118,18 @@ buildPythonPackage rec { # AttributeError: type object 'MagicMock' has no attribute ... "tests/test_fileio/test_backends/test_petrel_backend.py::TestPetrelBackend" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # RuntimeError: attempt to insert nil object from objects[1] + "tests/test_visualizer/test_visualizer.py::TestVisualizer::test_draw_featmap" + "tests/test_visualizer/test_visualizer.py::TestVisualizer::test_show" + + # AssertionError: torch.bfloat16 != torch.float32 + "tests/test_runner/test_amp.py::TestAmp::test_autocast" + + # ValueError: User specified autocast device_type must be cuda or cpu, but got mps + "tests/test_runner/test_runner.py::TestRunner::test_test" + "tests/test_runner/test_runner.py::TestRunner::test_val" ]; disabledTests = [ @@ -133,8 +146,16 @@ buildPythonPackage rec { # AssertionError: os is not "test_lazy_module" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Fails when max-jobs is set to use fewer processes than cores + # for example `AssertionError: assert 14 == 4` + "test_setup_multi_processes" ]; + # torch.distributed.DistNetworkError: The server socket has failed to bind. + __darwinAllowLocalNetworking = true; + meta = { description = "Library for training deep learning models based on PyTorch"; homepage = "https://github.com/open-mmlab/mmengine";