我将 Elixir 的版本从 1.7.4 升级到 1.15,现在我尝试运行
MIX_ENV=test mix test
,但一直收到错误 module ExUnitProperties is not loaded and could not be found
我的 mix.exs 有 {:stream_data, "~> 0.1", only: :test, runtime: false}
。我尝试将stream_data
升级到最新版本,但没有成功。
这是我已经尝试过的(MIX_ENV =测试):
mix deps.clean
mix compile --force
mix deps.tree
显示├──stream_data ~> 0.1(十六进制封装)mix.exs 有:
defp elixirc_paths(:test), do: ["lib", "test/support", "test/fixtures"]
完整的错误是:
error: module ExUnitProperties is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
test/support/generators.ex:4: Ab.Generators (module)
generators.ex 是:
defmodule Ab.Generators do
@moduledoc "Generators to use for property testing"
use ExUnitProperties
alias Ab.SafeTimex
def datetime do
ExUnitProperties.gen all(
year <- StreamData.member_of(1990..2030),
month <- StreamData.member_of(1..12),
day <- StreamData.member_of(1..31),
hour <- StreamData.member_of(0..23),
minute <- StreamData.member_of(0..59),
second <- StreamData.member_of(0..59)
) do
NaiveDateTime.new(year, month, day, hour, minute, second)
end
|> StreamData.filter(&match?({:ok, _}, &1))
|> StreamData.map(&elem(&1, 1))
|> StreamData.map(&SafeTimex.to_datetime(&1, :utc))
end
end
有什么想法或建议吗?谢谢!
如果删除
runtime: false
会发生什么?