petrus-jvrensburg

petrus-jvrensburg

I’m currently trying to use livebook to work with the suite of ex_cldr packages, but I’m tripping over the automatic execution of doctests.

E.g. for a minimal ex_cldr backend module definition, I’m seeing this error when the cell executes:

Evaluation process terminated - an exception was raised:
    ** (MatchError) no match of right hand side value: []
        lib/livebook/runtime/evaluator/doctests.ex:57: Livebook.Runtime.Evaluator.Doctests.report_doctest_result/2
        lib/livebook/runtime/evaluator/doctests.ex:27: anonymous fn/2 in Livebook.Runtime.Evaluator.Doctests.run/2
        (elixir 1.14.5) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
        lib/livebook/runtime/evaluator/doctests.ex:24: Livebook.Runtime.Evaluator.Doctests.run/2
        lib/livebook/runtime/evaluator.ex:465: Livebook.Runtime.Evaluator.continue_do_evaluate_code/6
        lib/livebook/runtime/evaluator.ex:330: Livebook.Runtime.Evaluator.loop/1
        (stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

The problem is that use Cldr in the backend module generates a bunch of code that includes doctests. And usually those doctests would pass, but the test setup does not seem to be replicated 100% when the code is generated in this way.

Would it make sense to add a flag for skipping doctests in cases like these?

Showing Posts 1 to 6

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hey @petrus-jvrensburg do you have an example livebook I can run that shows this issue? How are tests being run at all?

kip

kip

ex_cldr Core Team

I believe the error arises because the backend configuration you defined does not include the locales that the doctests use. In this case :pl is not configured.

You can chose to omit the docs for a backend module by adding generate_docs: false to the backend configuration and I believe that will mean no docs, and therefore no doc tests would be executed.

Its new to me that Livebook is executing doctests in this way though. It seems a little unexpected - what am I missing?

jonatanklosko

jonatanklosko

Creator of Livebook

Hey, it can happen when use Mod defines functions with doctests. Livebook should ignore those, we are looking into this : )

kip

kip

ex_cldr Core Team

That’s great to hear @jonatanklosko. They are, I think, first and foremost docs. That they are tests is almost a side affect.

petrus-jvrensburg

petrus-jvrensburg OP

That’s great. It would make sense for these to be ignored.

And thanks for all your effort, livebook is really good!

jonatanklosko

jonatanklosko

Creator of Livebook

FTR fixed in Don't run doctests for generated functions by jonatanklosko · Pull Request #1966 · livebook-dev/livebook · GitHub, will merge when the next Elixir v1.15 rc is out (but the fix also works with v1.14).

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91898 914
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews