Skip to content

Commit 51ea38a

Browse files
author
Parviz Khavari
committed
Fix warning adding if test name is longer then 256 chars
According to PyTest changes: pytest-dev/pytest@fd48cd5 Fixes #120
1 parent fffe4d6 commit 51ea38a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytest_reportportal/service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from _pytest.nodes import File, Item
1111
from _pytest.python import Class, Function, Instance, Module
1212
from _pytest.unittest import TestCaseFunction, UnitTestCase
13+
from _pytest.warning_types import PytestWarning
1314
from reportportal_client import ReportPortalServiceAsync
1415
from six import with_metaclass
1516
from six.moves import queue
@@ -454,9 +455,10 @@ def _get_item_name(test_item):
454455
if len(name) > 256:
455456
name = name[:256]
456457
test_item.warn(
457-
'C1',
458-
'Test node ID was truncated to "{}" because of name size '
459-
'constrains on reportportal'.format(name)
458+
PytestWarning(
459+
'Test node ID was truncated to "{}" because of name size '
460+
'constrains on reportportal'.format(name)
461+
)
460462
)
461463
return name
462464

0 commit comments

Comments
 (0)