diff --git a/allure-pytest/src/utils.py b/allure-pytest/src/utils.py index 808e4099..66bc6289 100644 --- a/allure-pytest/src/utils.py +++ b/allure-pytest/src/utils.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import os import six import pytest from allure_commons.utils import represent @@ -59,8 +58,8 @@ def mark_to_str(marker): def allure_package(item): parts = item.nodeid.split('::') - path = parts[0].split('.')[0] - return path.replace(os.sep, '.') + path = parts[0].rsplit('.', 1)[0] + return path.replace('/', '.') def allure_name(item): diff --git a/allure-pytest/test/labels/package/__init__.py b/allure-pytest/test/labels/package/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/allure-pytest/test/labels/package/path.with.dots/__init__.py b/allure-pytest/test/labels/package/path.with.dots/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/allure-pytest/test/labels/package/path.with.dots/path_with_dots_test.py b/allure-pytest/test/labels/package/path.with.dots/path_with_dots_test.py new file mode 100644 index 00000000..7e257575 --- /dev/null +++ b/allure-pytest/test/labels/package/path.with.dots/path_with_dots_test.py @@ -0,0 +1,17 @@ +""" +>>> allure_report = getfixture('allure_report') +""" + + +def test_path_with_dots(): + """ + >>> allure_report = getfixture('allure_report') + >>> assert_that(allure_report, + ... has_test_case('test_path_with_dots', + ... has_package( + ... ends_with('path.with.dots.path_with_dots_test'), + ... ), + ... ) + ... ) + """ + pass diff --git a/allure-python-commons-test/src/label.py b/allure-python-commons-test/src/label.py index cb08dfbe..7927295c 100644 --- a/allure-python-commons-test/src/label.py +++ b/allure-python-commons-test/src/label.py @@ -30,3 +30,7 @@ def has_story(story): def has_tag(tag): return has_label('tag', tag) + + +def has_package(package): + return has_label('package', package)