A pytest plugin for running tests against Minecraft releases
Project description
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_jar
fixture returns the path to the downloaded Minecraft client as apathlib.Path
instance.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_pack
fixture returns the path to the extracted vanilla resource pack as apathlib.Path
instance.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_pack
fixture returns the path to the extracted vanilla data pack as apathlib.Path
instance.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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-minecraft-0.1.1.tar.gz
.
File metadata
- Download URL: pytest-minecraft-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.3 Linux/5.4.0-1024-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8ff39bafa0e2d2d268b2f6bd122ab8457d95b0deff5928d0c1a60b4da5c54a4 |
|
MD5 | 749f3c5660a8eeaba21ac8f5953fc2fa |
|
BLAKE2b-256 | 373734b31fd9dcf3b4ac5e303234db36310a571a651ef3e1af0c22fef259b1b2 |
File details
Details for the file pytest_minecraft-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_minecraft-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.3 Linux/5.4.0-1024-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4df46ba87de22932c03b031b498e5c6fea9abf727ffb546e89431ce3a4952e02 |
|
MD5 | 7f5cfcc36cb02640d1fd6d8cbdbd79b8 |
|
BLAKE2b-256 | 22f59b8f596eaafa0197b7007ea4a64db237333b825ef54cb1c72ce20bd974b4 |