Git Product home page Git Product logo

mojo-pytest's Introduction

mojo-pytest's People

Contributors

guidorice avatar lleites avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lleites

mojo-pytest's Issues

Add filename, line and column number to MojoTestItem

When a python test is collected by pytest, it reports a line number and context like this:

    def test_ex():
>       raise Exception("here")
E       Exception: here

path/to/test_file.py:2: Exception

In IDEs like VSCode, we can quickly navigate to the failed test function/class by Cmd-click on the file:line.

In mojo-pytest this would be a useful enhancement at least to have at least the line number. It should be possible to resolve at the line number of failed MojoTestItems by scanning for the test name, and/or the assert failure message, in the mojo source file.

Add support for mojo v24.4

The current example/ project does not run with mojo v24.4, it simply needs a couple of simple patches because of changes in the String api, (use str() instead) and also where there are SIMD comparisons, which needs all(result == expect) for example. There might also be an issue with defining 'main' within a package is not yet supported which I don't fully understand yet.

However, a better approach for v24.4 is seems like for mojo-pytest to wrap the newmojo test ... functionality as a backend for mojo tests, rather than the previous approach which was calling mojo run ... as the backend.

Compiler warnings are not collected

mojo-pytest uses mojo run whereas as of Mojo 0.5.x, it appears that compiler warnings are only emitted by mojo build. Workarounds: none known. Possibly this could be re-written to use mojo build.

MOJO_ENABLE_ASSERTIONS as a default

This code from the README shows the opt-in behavior. In early mojo days, this option caused spurious errors and was not reliable.

# mojo assertion failures treated as errors (-D MOJO_ENABLE_ASSERTIONS)
pytest --mojo-assertions

I would like to convert this to a default and change it to an opt-out like:

pytest --disable-mojo-debug-assertions

The docs should also explain that this not any assertion, it's a Debug Assertion which the compiler can elide. (https://docs.modular.com/mojo/stdlib/builtin/debug_assert/debug_assert). Show some code snippets as well to explain the concept.

Code coverage support

The initial implementation of mojo-pytest simply uses mojo run, however using mojo build; mojo debug and passing appropriate LLDB commands to the process, could maybe enable pytest code coverage reporting.

Add support for `_test` suffix

Is it possible to add support for the _test suffix? In this case, a file whose name ends with _test.mojo or _test.๐Ÿ”ฅ would also be collected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.