Skip to content

Commit 3e2c42a

Browse files
author
Dzmitry Humianiuk
authored
Merge pull request #122 from zeburek/fix-pytest-warning
Fix warning adding if test name is longer then 256 chars
2 parents 22ec127 + 632871c commit 3e2c42a

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
@@ -459,9 +460,10 @@ def _get_item_name(test_item):
459460
if len(name) > 256:
460461
name = name[:256]
461462
test_item.warn(
462-
'C1',
463-
'Test node ID was truncated to "{}" because of name size '
464-
'constrains on reportportal'.format(name)
463+
PytestWarning(
464+
'Test node ID was truncated to "{}" because of name size '
465+
'constrains on reportportal'.format(name)
466+
)
465467
)
466468
return name
467469

0 commit comments

Comments
 (0)