Skip to content

worldomonation/mozci

 
 

Repository files navigation

Build Status PyPI version Docs

mozci

A library for inspecting push and task results in Mozilla's CI.

Installation

To install, run:

$ pip install mozci

Usage

Basic usage is to instantiate a Push object then start accessing properties and call methods. For example:

from mozci.push import Push

push = Push("79041cab0cc2", branch="autoland")
print("\n".join([t.label for t in push.tasks if t.failed]))

This will print all the failing tasks from a given push. See the documentation for more usage details and API docs.

Contributing

Mozci uses poetry to manage the project. So first make sure that is installed. Then clone the repo and run:

$ poetry install

This will create a virtualenv and install both project and dev dependencies in it. See the poetry documentation to learn how to work within the project.

To execute tests and linters, run:

$ tox

This should run successfully prior to submitting PRs (unless you need help figuring out the problem).

There are also some integration tests that will hit live data sources. These are run in a cron task and are excluded from the default test run. But if needed, you can run them locally via:

$ tox -e integration

Since tox installs packages on every invocation, it's much faster to run tests directly with pytest:

$ poetry run pytest tests

or

$ poetry shell
$ pytest tests

Additionally, you can install the pre-commit hooks by running:

$ pre-commit install

Linters and formatters will now run every time you commit.

Troubleshooting

poetry install locks up on Windows (upstream issue)

This can potentially be worked around like this:

python -m pip install virtualenv
python -m virtualenv .venv                   # IMPORTANT: Notice the dot in the name
.venv\Scripts\activate
pip install pip-tools
poetry export --dev --without-hashes -f requirements.txt > requirements.in
pip-compile --upgrade --generate-hashes --output-file requirements.txt requirements.in
pip install -r requirements.txt

About

A library for inspecting push and task results in Mozilla's CI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%