allankp / pytest-testrail

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

Have issues trying out with a simple python test. #21

Closed smartmouse closed 7 years ago

smartmouse commented 7 years ago

Thank you for the plugin, I am a new user to testRail and try to integrate with a simple python test- install.py I am following the readme but run into some issues. What did I miss here or do wrong? Any help is appreciated, how do we debug this? looks like , it does not like 'T75' Thanks in advance

import os
from pytest_testrail.plugin import testrail

@testrail('T75')
def test_install():
    os.system('echo installation test')
    os.system('slc -v')
    os.system('npm -v')
    os.system('node -v')

=======================

py.test install.py --testrail=setting.cfg --tr_name='install test'

================================================== test session starts ==================================================
platform darwin -- Python 2.7.10, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /Users/smartmouse, inifile: 
plugins: testrail-0.0.11
collected 2 items 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/main.py", line 98, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/main.py", line 132, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/main.py", line 141, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/main.py", line 590, in perform_collect
INTERNALERROR>     config=self.config, items=items)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/pytest_testrail/plugin.py", line 85, in pytest_collection_modifyitems
INTERNALERROR>     tr_keys = get_testrail_keys(items)
INTERNALERROR>   File "/Library/Python/2.7/site-packages/pytest_testrail/plugin.py", line 63, in get_testrail_keys
INTERNALERROR>     item.get_marker(TESTRAIL_PREFIX).kwargs.get('ids')
INTERNALERROR>   File "/Library/Python/2.7/site-packages/pytest_testrail/plugin.py", line 53, in clean_test_ids
INTERNALERROR>     return map(int, [test_id.upper().replace('C', '') for test_id in test_ids])
INTERNALERROR> ValueError: invalid literal for int() with base 10: 'T75'
allankilpatrick commented 7 years ago

@smartmouse If you look at the last line of the error

INTERNALERROR>     return map(int, [test_id.upper().replace('C', '') for test_id in test_ids])
INTERNALERROR> ValueError: invalid literal for int() with base 10: 'T75'

The plugin removes the C from the start of testcaseids, so that only the int is passed to testrail ( API only accepts ints )

So since you have used the: @testrail('T75')

The T character is being used as well which throws the error.

You should be using something like: @testrail('CXXXXXX')

This is stated in the README, give me a shout if you are still having issues.