mathieuprog / tz_extra

A few utilities to work with time zones in Elixir
Apache License 2.0
18 stars 1 forks source link

Unable to use TzExtra with `mix test` #2

Closed OldhamMade closed 2 years ago

OldhamMade commented 3 years ago
$ asdf current erlang
erlang          24.0.1

$ asdf current elixir
elixir          1.12.0-otp-24

$ MIX_ENV=test mix deps.get

$ MIX_ENV=test mix deps.compile tz

$ MIX_ENV=test mix deps.compile tz_extra
==> tz_extra
Compiling 7 files (.ex)

== Compilation error in file lib/compiler_runner.ex ==
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not a nonempty list

    :erlang.hd([])
    lib/compiler.ex:143: anonymous fn/1 in TzExtra.Compiler.add_offset_data/1
    (elixir 1.12.0) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.12.0) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
    lib/compiler.ex:20: TzExtra.Compiler.compile/0
    lib/compiler_runner.ex:6: (module)
could not compile dependency :tz_extra, "mix compile" failed. You can recompile this dependency with "mix deps.compile tz_extra", update it with "mix deps.update tz_extra" or clean it with "mix deps.clean tz_extra"

This is on macOS. I get the same if I set MIX_ENV=prod.

OldhamMade commented 3 years ago
    defp add_offset_data(time_zones) do
      Enum.map(time_zones, fn %{time_zone: time_zone_id} = time_zone ->
        {:ok, periods} = Tz.PeriodsProvider.periods(time_zone_id)
+       IO.inspect(Enum.count(periods), label: "found periods for timezone #{time_zone_id}")

        {utc_offset, dst_offset, zone_abbr, dst_zone_abbr} =
          case hd(periods) do
==> tz_extra
Compiling 7 files (.ex)
found periods for timezone Europe/Andorra: 16
found periods for timezone Asia/Dubai: 0

== Compilation error in file lib/compiler_runner.ex ==
mathieuprog commented 3 years ago

See https://github.com/mathieuprog/tz/issues/8

mathieuprog commented 2 years ago

Duplicate issue with https://github.com/mathieuprog/tz_extra/issues/3

See https://github.com/mathieuprog/tz_extra/issues/3 for further updates.

mathieuprog commented 2 years ago

Fixed in 0.20.1