A pytest plugin for reporting results to the Applause Automation services.
In your conftest.py file, add the following to register the ApplausePyTestPlugin:
def pytest_configure(config: pytest.Config):
app_config=ApplauseConfig(
api_key="api_key",
product_id=123
)
config.pluginmanager.register(ApplausePytestPlugin(app_config), 'applause-pytest-plugin')
You can then inject the Applause Result into your pytest test case:
def test_something(self, applause_result: ApplauseResult):
# Some test case
pass
Remote Selenium Webdrivers that are proxied through the Applause Selenium Proxy can be registered to an Applause Result to link up the remote session to the test case result.
def test_something(self, driver: WebDriver, applause_result: ApplauseResult):
# Some test case
applause_result.register_session_id(driver.session_id)
pass
You can upload any binary asset to an Applause result
def test_something(self, applause_result: ApplauseResult):
# Some test case
asset = "asset".encode("utf-8")
applause_result.attach_asset(
asset_name="asset.txt",
asset=asset,
asset_type=AssetType.UNKNOWN,
)
pass
pip install poetry
poetry install # installs python dependencies into poetry
poetry install --dev # installs python dev-dependencies into poetry
Optionally, run this command to stick python virtualenv to project directory.
poetry config virtualenvs.in-project true
We use tox to automate our build pipeline. Running the default tox configuration will install dependencies, format and lint the project, run the unit test and run the build. This will verify the project builds correctly for python 3.8, 3.9, 3.10, and 3.11.
poetry run tox
The plugin can be linted through tox tox run -e lint
The unit tests can be executed through tox tox run -e test
https://www.jetbrains.com/help/idea/poetry.html
# list details of the poetry environment
poetry env info
# To activate this project's virtualenv, run the following:
poetry shell
# To exit the virtualenv shell:
exit
# To install packages into this virtualenv:
poetry add YOUR_PACKAGE