allankp / pytest-testrail

pytest plugin for integration with TestRail, for creating testruns and updating results
MIT License
95 stars 125 forks source link

Settings file <settings file>.cfg can not be read properly by py.test - Invalid URL error occurs #142

Closed jbotonjic closed 3 years ago

jbotonjic commented 3 years ago

Describe the bug After running cmd for creating a testrun I got a an error that URL is not set properly.

To Reproduce Steps to reproduce the behavior:

  1. Prepare .cfg and run the py.test as described on https://pypi.org/project/pytest-testrail/

    py.test --testrail --tr-config=testconfig.cfg ... INTERNALERROR> File "C:\Users\Username\AppData\Roaming\Python\Python39\site-package s\requests\models.py", line 388, in prepare_url INTERNALERROR> raise MissingSchema(error) INTERNALERROR> requests.exceptions.MissingSchema: Invalid URL 'index.php?/api/v2/add_run/Non e': No schema supplied. Perhaps you meant http://index.php?/api/v2/add_run/None? [testrail] Start publishing [testrail] End publishing

Expected behavior py.test cmd should finish successfully, testrun should be created in Testrail.

My testconfig.cfg looks like: [API] url = https://mycompany.testrail.io/ email = myuseremail password = mypassword

[TESTRUN] project_id = 1 suite_id = 1 run_id = 2 description = 'This is an example testrun description'

[TESTCASE] custom_comment = 'This is a custom comment for testcase'

Desktop (please complete the following information):

allankp commented 3 years ago

The run_id is the issue is None on the URL request. This has to be sent as part of the command not in the config file: https://github.com/allankp/pytest-testrail/blob/master/pytest_testrail/conftest.py#L147