2.2. Use PyTest to run tests
Warning
The tests are not yet complete. Tests are being written as we add new functionality to the module. We hope this will be completed soon.
If you want to contribute to the project, please consider writing tests for the module in the github repository.
All tests are written using PyTest. To run the tests, you need to install PyTest and run the tests using the
pytestcommand.All tests are located in the
testsfolder. Thetestsfolder contains aconftest.pyfile that contains fixtures that are used by the tests.If you are using PyCharm, you can run the tests by right-clicking on the
testsfolder and selectingRun 'pytest in tests'.All tests are written using the
assertstatement. If the assertion fails, the test fails.The tests use same structure of the module. For example, the tests for the
blizzardAPI.world_of_warcraft.game_datamodule are located in theblizzardAPI\tests\world_of_warcraft\game_datafolder.
2.2.1. Run all tests
Note
By default, the tests are setted up to use .env file to load the environment variables. If you not have a .env file, you can use the arguments to pass the environment variables to the tests. Read here for more information.
2.2.1.1. Using .env file
To run all tests, run the following command from the root of the project folder where .env file is located with the following content:
pytest blizzardAPI
2.2.1.2. Using specific keys
To run all tests, run the following command from the root of the project folder:
pytest blizzardAPI --client YOUR_CLIENT_ID --secret YOUR_SECRET --region YOUR_REGION
2.2.2. Run specific tests
Note
By default, the tests are setted up to use .env file to load the environment variables. If you not have a .env file, you can use the arguments to pass the environment variables to the tests. Read here for more information.
2.2.2.1. Using .env file
To run all tests, run the following command from the root of the project folder where .env file is located with the following content:
pytest blizzardAPI\tests\world_of_warcraft\game_data\test_reputation.py
pytest blizzardAPI -k test_reputation
2.2.2.2. Using specific keys
To run specific tests, run the following command from the root of the project folder:
pytest blizzardAPI\tests\world_of_warcraft\game_data\test_reputation.py -client YOUR_CLIENT_ID --secret YOUR_SECRET --region YOUR_REGION
pytest blizzardAPI -k test_reputation -client YOUR_CLIENT_ID --secret YOUR_SECRET --region YOUR_REGION