Automatic tests

minecraft-launcher-lib uses Pytest to run some automatic tests. The tests only covers the utils functions. The main things like installing, launching and logging in to Microsoft are not covered, because I don’t know how to do this, if it should work in the Codeberg CI as well.

Using Pytest

To get started, install it:

pip install pytest

To run the tests, open a command line in the root directory of minecraft-launcher-lib and execute:

pytest

If a test fails, you should fix the bug.

Test Coverage

To get the test coverage (which lines are executed during the tests) you will need pytest-cov.

Install it with pip:

pip install pytest-cov

Run pytest with coverage:

pytest -v --cov=minecraft_launcher_lib  --cov-report html

A new directory called htmlcov will be created. Open the index.html from this dircetory with your browser to see the coverage report.