Skip to content

Commit a605a10

Browse files
KillAChickensseliverstov
authored andcommitted
Fix package name for paths with dots and non-slash separators (fixes #146 via #190)
1 parent 58e78a0 commit a605a10

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

allure-pytest/src/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
import os
54
import six
65
import pytest
76
from allure_commons.utils import represent
@@ -59,8 +58,8 @@ def mark_to_str(marker):
5958

6059
def allure_package(item):
6160
parts = item.nodeid.split('::')
62-
path = parts[0].split('.')[0]
63-
return path.replace(os.sep, '.')
61+
path = parts[0].rsplit('.', 1)[0]
62+
return path.replace('/', '.')
6463

6564

6665
def allure_name(item):

allure-pytest/test/labels/package/__init__.py

Whitespace-only changes.

allure-pytest/test/labels/package/path.with.dots/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
>>> allure_report = getfixture('allure_report')
3+
"""
4+
5+
6+
def test_path_with_dots():
7+
"""
8+
>>> allure_report = getfixture('allure_report')
9+
>>> assert_that(allure_report,
10+
... has_test_case('test_path_with_dots',
11+
... has_package(
12+
... ends_with('path.with.dots.path_with_dots_test'),
13+
... ),
14+
... )
15+
... )
16+
"""
17+
pass

allure-python-commons-test/src/label.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ def has_story(story):
3030

3131
def has_tag(tag):
3232
return has_label('tag', tag)
33+
34+
35+
def has_package(package):
36+
return has_label('package', package)

0 commit comments

Comments
 (0)