GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix allure_full_name parsing when square bracers is in param contents by skhomuti · Pull Request #708 · allure-framework/allure-python

Fix allure_full_name parsing when square bracers is in param contents #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
baev merged 1 commit into master from full_name_fix
Nov 23, 2022

Uh oh!

There was an error while loading. Please reload this page.

Merged

Fix allure_full_name parsing when square bracers is in param contents #708

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
8c5a792
Fix allure_full_name parsing when square bracers is in param contents
skhomuti Nov 22, 2022
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

10 changes: 4 additions & 6 deletions 10 allure-pytest/src/utils.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,11 @@ def allure_name(item, parameters):
return SafeFormatter().format(title, **{**parameters, **item.funcargs}) if title else name


def allure_full_name(item):
parts = item.nodeid.split('::')
def allure_full_name(item: pytest.Item):
package = allure_package(item)
clazz = '.{clazz}'.format(clazz=parts[1]) if len(parts) > 2 else ''
test_with_params = parts[-1]
test = test_with_params.rsplit("[", 1)[0]
full_name = '{package}{clazz}#{test}'.format(package=package, clazz=clazz, test=test)
class_name = f".{item.parent.name}" if isinstance(item.parent, pytest.Class) else ''
test = item.originalname if isinstance(item, pytest.Function) else item.name.split("[")[0]
full_name = f'{package}{class_name}#{test}'
return escape_name(full_name)


Expand Down
20 changes: 19 additions & 1 deletion 20 allure-pytest/test/acceptance/parametrization/parametrization_test.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from hamcrest import assert_that
from hamcrest import assert_that, has_entry, ends_with
from allure_commons_test.report import has_test_case
from allure_commons_test.result import has_parameter, with_excluded, with_mode

Expand Down Expand Up @@ -173,3 +173,21 @@ def test_dynamic_parameter_override_from_fixture(executed_docstring_source):
has_parameter("param1", "'readable-value'")
)
)


def test_fullname_with_braces(executed_docstring_source):
"""
>>> import pytest
... import allure

>>> class TestClass:
... @pytest.mark.parametrize("param1", ["qwe]["])
... def test_with_braces(self, param1):
... pass
"""
assert_that(executed_docstring_source.allure_report,
has_test_case("test_with_braces[qwe][]",
has_entry('fullName', ends_with(".TestClass#test_with_braces")),
has_parameter("param1", "'qwe]['")
)
)
4 changes: 2 additions & 2 deletions 4 allure-pytest/test/integration/pytest_doctest/pytest_doctest_test.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@allure.feature("Integration")
def test_pytest_docktest(allured_testdir):
def test_pytest_doctest(allured_testdir):
allured_testdir.testdir.makepyfile('''
def some_func():
"""
Expand All @@ -19,6 +19,6 @@ def some_func():
allured_testdir.run_with_allure("--doctest-modules")

assert_that(allured_testdir.allure_report,
has_test_case("test_pytest_docktest.some_func",
has_test_case("test_pytest_doctest.some_func",
with_status("passed"))
)
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.