Skip to content

Commit

Permalink
Fix example commands in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
guidorice committed Sep 14, 2024
1 parent 746e419 commit 3de2df3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,31 @@ does not have any awareness of Mojo source or package structure, `pytest` is ext

1. Create your Mojo tests according to the manual: https://docs.modular.com/mojo/tools/testing .

2. Install `mojo`, `python`, `pytest` and `pytest-mojo` plugin using the [conda](https://docs.anaconda.com/miniconda/)
2. Install Mojo, Python, `pytest` and this `pytest-mojo` plugin using the [conda](https://docs.anaconda.com/miniconda/)
[environment.yml](environment.yml) file. This can alternatively be done with the [magic](https://docs.modular.com/magic/)
package manager, but [conda](https://docs.anaconda.com/miniconda/) is easier for this use case.

```shell
# use conda to install mojo, python, and the pytest-mojo plugin.
$ conda env -n foo-project create -f environment.yml
$ conda env create -n foo-project -f environment.yml

# verify environment
$ conda activate foo-project

$ mojo --version
mojo 24.5.0 (e8aacb95)

$ python --version
Python 3.12.6

$ conda list pytest
...
pytest 8.3.3 pyhd8ed1ab_0 conda-forge
pytest-mojo 24.5 pypi_0 pypi
pytest-xdist 3.6.1 pyhd8ed1ab_0 conda-forge
```

Summary: it is a requirement is to have a `python` and `mojo` sharing the same runtime and packages and
Summary: it is a requirement is to have Python and Mojo sharing the same runtime and packages and
[conda](https://docs.anaconda.com/miniconda/) is the easiest way to accomplish that.

3. See the example project for one possible filesystem layout:
Expand Down Expand Up @@ -110,9 +113,9 @@ example_tests

## Links

- If you experience slowness, see this [tip about using multiprocessing]( https://github.com/guidorice/mojo-pytest/wiki#2024-07-17-here-is-a-performance-tip)
with pytest.
- If you experience slowness, see this
[tip about using multiprocessing]( https://github.com/guidorice/mojo-pytest/wiki#2024-07-17-here-is-a-performance-tip) with `pytest`.
- Writing tests in Mojo: https://docs.modular.com/mojo/tools/testing
- Non-Python tests in `pytest`: https://pytest.org/en/7.4.x/example/nonpython.html#non-python-tests
- C test runner: https://pytest-c-testrunner.readthedocs.io/
- Pytest docs: https://docs.pytest.org
- Non-Python tests in `pytest`: https://pytest.org/en/latest/example/nonpython.html#non-python-tests
- C test runner: https://pytest-c-testrunner.readthedocs.io
- `pytest` docs: https://docs.pytest.org

0 comments on commit 3de2df3

Please sign in to comment.