Skip to content
Alex G Rice edited this page Jul 17, 2024 · 1 revision

2024-07-17 here is a performance tip!

As of v24.4, mojo-pytest plugin wraps the mojo test command, actually running a new subprocess for every single test discovered. This is quite a bottleneck, so let's hope mojo test gets more optimized in the future. However an easy speed boost is to run pytest in parallel. Using the example project from the readme:

$ pip install pytest-xdist
$ export PYTHONPATH=/Users/guidorice/mojo/mojo-pytest/example_src/
$ pytest -n auto --mojo-include build/ example_tests/
============================ test session starts =============================
platform darwin -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0
rootdir: /Users/guidorice/mojo/mojo-pytest
plugins: xdist-3.6.1, mojo-24.4.0
8 workers [6 items]     
......                                                                 [100%]
============================= 6 passed in 3.15s ==============================

which is about a 2X speedup on my dev laptop. 🚀

Clone this wiki locally