Unverified Commit 04109824 authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

python3Packages: export MPLBACKEND to Agg to fix matplotlib tests on darwin (#480979)

parents 67c55301 1fcce504
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -53,9 +53,14 @@ buildPythonPackage rec {
    "dscribe.ext"
  ];

  preCheck =
    # Prevents python from loading dscribe from the current working directory instead of using $out
  preCheck = ''
    ''
      rm -rf dscribe
    ''
    # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      export MPLBACKEND="Agg"
    '';

  nativeCheckInputs = [
@@ -72,11 +77,6 @@ buildPythonPackage rec {
      [
        # AssertionError on a numerical test
        "test_cell_list"
      ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    "test_examples"
      ];

  # Broken due to use of missing _get_constraints attr in ase >= 3.26.0
+5 −6
Original line number Diff line number Diff line
@@ -52,15 +52,14 @@ buildPythonPackage rec {
  ]
  ++ lib.optionals (pythonOlder "3.11") [ tomli ];

  env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
    # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
    MPLBACKEND = "Agg";
  };

  disabledTests = [
    # Test requires extra nltk data dependency
    "test_text_mining"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    "test_hill_slopes"
    "test_two_key_plot"
  ];

  nativeCheckInputs = [ pytestCheckHook ];
+5 −11
Original line number Diff line number Diff line
@@ -70,22 +70,16 @@ buildPythonPackage rec {
    openssh
  ];

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    "test_optimize_kl_domain_expansion"
    "test_plot_priorsamples"
  # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
  preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export MPLBACKEND="Agg"
  '';

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # [XPASS(strict)] np.vdot inaccurate for single precision
    "test_vdot"
  ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    "test/test_plot.py"
  ];

  __darwinAllowLocalNetworking = true;
  postCheck =
    lib.optionalString
+9 −22
Original line number Diff line number Diff line
@@ -84,9 +84,14 @@ buildPythonPackage rec {
    ];
  };

  preCheck =
    # grpc tests are racy
  preCheck = ''
    ''
      sed -i '/"grpc",/d' optuna/testing/storages.py
    ''
    # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      export MPLBACKEND="Agg"
    '';

  nativeCheckInputs = [
@@ -117,24 +122,6 @@ buildPythonPackage rec {
    "test_plot_intermediate_values"
    "test_plot_rank"
    "test_plot_terminator_improvement"

    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    "test_edf_plot_no_trials"
    "test_get_timeline_plot"
    "test_plot_contour"
    "test_plot_contour_customized_target_name"
    "test_plot_edf_with_multiple_studies"
    "test_plot_edf_with_target"
    "test_plot_parallel_coordinate"
    "test_plot_parallel_coordinate_customized_target_name"
    "test_plot_param_importances"
    "test_plot_param_importances_customized_target_name"
    "test_plot_param_importances_multiobjective_all_objectives_displayed"
    "test_plot_slice"
    "test_plot_slice_customized_target_name"
    "test_target_is_none_and_study_is_multi_obj"
    "test_visualizations_with_single_objectives"
  ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
+4 −19
Original line number Diff line number Diff line
@@ -133,6 +133,10 @@ buildPythonPackage rec {
    # ensure tests can find these
    ''
      export PMG_TEST_FILES_DIR="$(realpath ./tests/files)"
    ''
    # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      export MPLBACKEND="Agg"
    '';

  disabledTests = [
@@ -147,25 +151,6 @@ buildPythonPackage rec {
    "test_mean_field"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Fatal Python error: Aborted
    # matplotlib/backend_bases.py", line 2654 in create_with_canvas
    # https://github.com/materialsproject/pymatgen/issues/4452
    "test_angle"
    "test_as_dict_from_dict"
    "test_attributes"
    "test_basic"
    "test_core_state_eigen"
    "test_eos_func"
    "test_get_info_cohps_to_neighbors"
    "test_get_plot"
    "test_get_point_group_operations"
    "test_matplotlib_plots"
    "test_ph_plot_w_gruneisen"
    "test_plot"
    "test_proj_bandstructure_plot"
    "test_structure"
    "test_structure_environments"

    # attempt to insert nil object from objects[1]
    "test_timer_10_2_7"
    "test_timer"