pytest-minecraft
A pytest plugin for running tests against Minecraft releases.
The plugin automatically downloads the latest version of the Minecraft client into the pytest cache. The provided fixtures can also extract the vanilla resource pack and data pack on demand.
Installation
The package can be installed with pip.
$ pip install pytest-minecraft
Usage
Downloading the Minecraft client takes a few seconds so the tests that use the fixtures provided by the plugin will be skipped unless explicitly enabled with a command-line flag. The --minecraft-latest flag will enable the tests and run them against the latest stable release.
$ pytest --minecraft-latest
You can also use the --minecraft-snapshot flag to test against the latest snapshot. Both flags can be specified at the same time to run the tests against both stable and snapshot releases.
$ pytest --minecraft-latest --minecraft-snapshot
Fixtures
-
The
minecraft_client_jarfixture returns the path to the downloaded Minecraft client as apathlib.Pathinstance.def test_with_client(minecraft_client_jar): assert minecraft_client_jar.name == "client.jar" with ZipFile(minecraft_client_jar) as client: assert len(client.namelist()) > 10_000
-
The
minecraft_resource_packfixture returns the path to the extracted vanilla resource pack as apathlib.Pathinstance.def test_with_resource_pack(minecraft_resource_pack): assert minecraft_resource_pack.name == "resource_pack" assert (minecraft_resource_pack / "assets" / "minecraft" / "textures").is_dir()
-
The
minecraft_data_packfixture returns the path to the extracted vanilla data pack as apathlib.Pathinstance.def test_with_data_pack(minecraft_data_pack): assert minecraft_data_pack.name == "data_pack" assert (minecraft_data_pack / "data" / "minecraft" / "loot_tables").is_dir()
Contributing
Contributions are welcome. This project uses poetry.
$ poetry install
You can run the tests with poetry run pytest.
$ poetry run pytest
The code follows the black code style.
$ poetry run black .
License - MIT
Release files for pytest-minecraft 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-minecraft-0.2.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_minecraft-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / pytest-minecraft-0.2.0.tar.gz
| Download URL | pytest-minecraft-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d488eb71f686000aafd8674452090e7f619c2cb5073e1237b3f98edbdbcbed1
|
|
BLAKE2b-256 checksum How to use checksums |
271660b26976b0f58bca0e7397dcde9a3c883015a3d4f4155de158aa24c8c4ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.8.10 Linux/4.19.128-microsoft-standard
|
Release files / pytest_minecraft-0.2.0-py3-none-any.whl
| Download URL | pytest_minecraft-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad8533453a11f260bfd7087fb467853ee0cfc2f80644a133bae2819828aa7742
|
|
BLAKE2b-256 checksum How to use checksums |
c52a9aad929b0e5f28857bd4fd056e61b75bbc286d5c243876b7cb838420fcaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.8.10 Linux/4.19.128-microsoft-standard
|