pleroma/test/test_helper.exs
Phantasm 5addbf39fb
Elixir 1.18 Deal with :warnings_as_errors deprecation in compiler_options/1
warning: :warnings_as_errors is deprecated as part of Code.get_compiler_option/1
  (elixir 1.18.3) lib/code.ex:1597: Code.get_compiler_option/1
  (elixir 1.18.3) lib/code.ex:1572: anonymous fn/2 in Code.compiler_options/1
  (elixir 1.18.3) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
  (elixir 1.18.3) lib/code.ex:1571: Code.compiler_options/1
  (pleroma 2.9.1-77-g8ec49c59-elixir-1-18+test) lib/pleroma/application.ex:104: Pleroma.Application.start/2
  (kernel 10.2.6) application_master.erl:295: :application_master.start_it_old/4

warning: :warnings_as_errors is deprecated as part of Code.put_compiler_option/2, instead you must pass it as a --warnings-as-errors flag. If you need to set it as a default in a mix task, you can also set it under aliases: [compile: "compile --warnings-as-errors"]
  (elixir 1.18.3) lib/code.ex:1710: Code.put_compiler_option/2
  (elixir 1.18.3) lib/code.ex:1573: anonymous fn/2 in Code.compiler_options/1
  (elixir 1.18.3) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
  (elixir 1.18.3) lib/code.ex:1571: Code.compiler_options/1
  (pleroma 2.9.1-77-g8ec49c59-elixir-1-18+test) lib/pleroma/application.ex:104: Pleroma.Application.start/2
  (kernel 10.2.6) application_master.erl:295: :application_master.start_it_old/4
2025-05-13 14:02:47 +02:00

44 lines
1.3 KiB
Elixir

# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
ExUnit.configure(capture_log: true, max_cases: System.schedulers_online())
ExUnit.start(exclude: [:federated])
if match?({:unix, :darwin}, :os.type()) do
excluded = ExUnit.configuration() |> Keyword.get(:exclude, [])
excluded = excluded ++ [:skip_darwin]
ExUnit.configure(exclude: excluded)
end
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, :manual)
Mox.defmock(Pleroma.ReverseProxy.ClientMock, for: Pleroma.ReverseProxy.Client)
Mox.defmock(Pleroma.GunMock, for: Pleroma.Gun)
{:ok, _} = Application.ensure_all_started(:ex_machina)
ExUnit.after_suite(fn _results ->
uploads = Pleroma.Config.get([Pleroma.Uploaders.Local, :uploads], "test/uploads")
File.rm_rf!(uploads)
end)
defmodule Pleroma.Test.StaticConfig do
@moduledoc """
This module provides a Config that is completely static, built at startup time from the environment. It's safe to use in testing as it will not modify any state.
"""
@behaviour Pleroma.Config.Getting
@config Application.get_all_env(:pleroma)
@impl true
def get(path, default \\ nil) do
get_in(@config, path) || default
end
@impl true
def get!(path) do
get_in(@config, path)
end
end