Getting warnings about Application.get_env/2 in test support files
Closed this issue · 3 comments
When using Elixir 1.14.0 with OTP 25, we get a new set of warnings when running mix test
Here are the warnings.
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:29: Ecto.Integration.Post
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:85: Ecto.Integration.Comment
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:109: Ecto.Integration.Permalink
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:133: Ecto.Integration.PostUser
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:151: Ecto.Integration.User
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:182: Ecto.Integration.Custom
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:200: Ecto.Integration.Barebone
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:216: Ecto.Integration.Tag
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:269: Ecto.Integration.Order
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:286: Ecto.Integration.CompositePk
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:307: Ecto.Integration.CorruptedPk
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:322: Ecto.Integration.PostUserCompositePk
warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
deps/ecto/integration_test/support/schemas.exs:339: Ecto.Integration.Usec
@warmwaffles I might be able to help with it, but I can't reproduce the warnings.
I just updated my main
branch, rm -fR deps _build
, mix deps.get
, and mix test
. The warnings I ended up seeing are the ones below:
warning: invalid association `users` in schema EctoSQLite3.Integration.Account: associated schema EctoSQLite3.Integration.User does not exist
test/support/schemas.ex:1: EctoSQLite3.Integration.Account (module)
warning: invalid association `products` in schema EctoSQLite3.Integration.Account: associated schema EctoSQLite3.Integration.Product does not exist
test/support/schemas.ex:1: EctoSQLite3.Integration.Account (module)
Here are the runtime versions I'm using:
$ elixir --version; mix archive; mix deps | grep exqlite
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.14.4 (compiled with Erlang/OTP 25)
* hex-2.0.6
* phx_new-1.7.2
Archives installed at: $HOME/.asdf/installs/elixir/1.14.4-otp-25/.mix/archives
* exqlite (Hex package) (mix)
locked at 0.11.8 (exqlite) 85919592
I just realized that it was reported on Sep 8, 22. After a bit of investigation, I reproduced this error in v0.8.2
. It's a warning in Ecto itself, not in ecto_sqlite3
– and it was probably fixed by 62dda12 or 6f1ca67.
In any case, I can't reproduce it in v0.10.2
. Should we close the issue?
FYI, the command I used to find relevant changes in mix.lock
was:
git log --after=2022-09-01 --grep=ecto mix.lock
Honestly I can't remember running into this in the last few months. Let's close this.