Geospatial Software Developer: geographic information systems (GIS), remote sensing, data science, and machine learning.
- Python ๐ / Mojo ๐ฅ
- TypeScript
update: 2024-01-05
Mojo๐ฅ language test runner plugin for pytest. (aka pytest-mojo)
License: MIT License
Geospatial Software Developer: geographic information systems (GIS), remote sensing, data science, and machine learning.
update: 2024-01-05
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.
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.
There is a debug_assert
feature in mojo. https://docs.modular.com/mojo/stdlib/builtin/debug_assert.html
When it is fully working modularml/mojo#622, it would be nice to support this for mojo-pytest MojoTest
items.
Raising Error
will prevent subsequent test items from running. To work around this limitation it is recommended to use additional test_***.mojo
files, rather than writing numerous test items in a test file.
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
.
There are some updates needed to support mojo 0.6.
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.