Closed maksim-andr closed 5 years ago
This is not something I would include in the plugin. You could add something to your own conftest or maybe if you are running in CI. Those normally have some sort of plugin that allows publishing to Telegram, Slack etc.
I resolved this issue via pytest session:
def get_testrail_run_link(pytest_session):
plugin_manager = pytest_session.config.pluginmanager
if 'pytest-testrail-instance' in plugin_manager._name2plugin.keys():
pti = plugin_manager._name2plugin['pytest-testrail-instance']
run_id = pti.testrun_id
testrail_api_url = pti.client._url
testrail_url = testrail_api_url.split('?')[0]
run_url = '{}?/runs/view/{}'.format(testrail_url, run_id)
return run_url
Hi! I need to use a link of run in any "finish hooks", e.g. "pytest_sessionfinish". This link must be sent to email or telegram bot. How can I get this link easily?