elixir-gettext / gettext

Internationalization and localization support for Elixir.
https://hexdocs.pm/gettext
461 stars 87 forks source link

Flaky test in `gettext.extract` #341

Closed maennchen closed 1 year ago

maennchen commented 1 year ago
Randomized with seed 322348
.

  1) test extracting and extracting with --merge (Mix.Tasks.Gettext.ExtractTest)
     /home/maennchen/Development/open-source/gettext/test/mix/tasks/gettext.extract_test.exs:22
     Assertion with =~ failed
     code:  assert read_file("priv/gettext/default.pot") =~
              "#: lib/my_app.ex:7\n#, elixir-autogen, elixir-format\nmsgid \"hello\"\nmsgstr \"\"\n"
     left:  "## This file is a PO Template file.\n##\n## \"msgid\"s here are often extracted from source code.\n## Add new messages manually only if they're dynamic\n## messages that can't be statically extracted.\n##\n## Run \"mix gettext.extract\" to bring this file up to\n## date. Leave \"msgstr\"s empty as changing them here has no\n## effect: edit them in PO (.po) files instead.\n#\nmsgid \"\"\nmsgstr \"\"\n\n#, elixir-autogen, elixir-format\nmsgid \"hello\"\nmsgstr \"\"\n"
     right: "#: lib/my_app.ex:7\n#, elixir-autogen, elixir-format\nmsgid \"hello\"\nmsgstr \"\"\n"
     stacktrace:
       test/mix/tasks/gettext.extract_test.exs:43: (test)

..
Finished in 0.5 seconds (0.00s async, 0.5s sync)
4 tests, 1 failure

This only seems to fix it most of the time: https://github.com/elixir-gettext/gettext/blob/26237d2821663c3c3a5028628125c577e55cae13/test/mix/tasks/gettext.extract_test.exs#L17

I'm investigating and will open a PR.