Hello,
almost total newbie coming from Python here. I’m developing my first
Phoenix+Ecto application and now I’m in the process of importing
some data from an old database and writing tests for it.
I’m using Elixir 1.9.2/OTP 22 and latest Ecto 3 (3.2.4)
I wanted to debug an issue happening with the test and because I’m
using the nice ElixirLS
(the fork) with my editor (emacs 26) I wanted to try out its debug
support. As
advised, I
have prepared a configuration for the debugging session, here is its
translation in elisp:
(list :type "Elixir"
:cwd "/home/azazel/wip/journey/apps/data/"
:request "launch"
:task "test"
:dap-server-path '("/home/azazel/wip/elixir/elixir-ls/release/debugger.sh")
:taskArgs (list "--trace")
:projectDir "/home/azazel/wip/journey/apps/data/"
:requireFiles (list "test/**/test_helper.exs"
"test/**/*_test.exs")
:program nil
:name "mix test")
Running it, it ignores any set up breakpoint and terminates with an
error:
Started ElixirLS debugger
Elixir version: "1.9.2 (compiled with Erlang/OTP 22)"
Erlang version: "22"
(Debugger) Initialization failed because an exception was raised:
** (RuntimeError) could not lookup Ecto repo Journey.Data.Repo because it was not started or it does not exist
Elixir.Ecto.Repo.Registry.erl:19: Ecto.Repo.Registry.lookup/1
Elixir.Ecto.Adapter.erl:127: Ecto.Adapter.lookup_meta/1
Elixir.Ecto.Adapters.SQL.Sandbox.erl:487: Ecto.Adapters.SQL.Sandbox.lookup_meta!/1
Elixir.Ecto.Adapters.SQL.Sandbox.erl:388: Ecto.Adapters.SQL.Sandbox.mode/2
11:29:44.316 [error] Process #PID<0.112.0> raised an exception
** (RuntimeError) could not lookup Ecto repo Journey.Data.Repo because it was not started or it does not exist
Elixir.Ecto.Repo.Registry.erl:19: Ecto.Repo.Registry.lookup/1
Elixir.Ecto.Adapter.erl:127: Ecto.Adapter.lookup_meta/1
Elixir.Ecto.Adapters.SQL.Sandbox.erl:487: Ecto.Adapters.SQL.Sandbox.lookup_meta!/1
Elixir.Ecto.Adapters.SQL.Sandbox.erl:388: Ecto.Adapters.SQL.Sandbox.mode/2
Do anyone knows how can I make it running? As I understand it the
problems is that when the code for the tests is evaluated, probably
the code that starts the Ecto’s Repo process has yet to be executed,
but I don’t know why and I haven’t found any clear explanantion.
In the meantime, I’ve tried also the :debugger way as suggested in
this
thread,
but without success.