FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add inversion key and condition in select_by_testcase by Lirlili · Pull Request #634 · allure-framework/allure-python · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 11 additions & 4 deletions allure-pytest/src/plugin.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def pytest_addoption(parser):
dest="attach_capture",
help="Do not attach pytest captured logging/stdout/stderr to report")

parser.getgroup("reporting").addoption('--inversion',
action="store",
dest="inversion",
default=False,
help="Run tests not in testplan")

def label_type(type_name, legal_values=set()):
def a_label_type(string):
atoms = set(string.split(','))
Expand Down Expand Up @@ -165,8 +171,9 @@ def select_by_labels(items, config):
return items, []


def select_by_testcase(items):
def select_by_testcase(items, config):
planned_tests = get_testplan()
is_inversion = config.option.inversion

if planned_tests:

Expand All @@ -180,8 +187,8 @@ def is_planed(item):
planed_item_string_id in allure_string_ids
or planed_item_selector == allure_full_name(item)
):
return True
return False
return True if not is_inversion else False
return False if not is_inversion else True

selected, deselected = [], []
for item in items:
Expand All @@ -192,7 +199,7 @@ def is_planed(item):


def pytest_collection_modifyitems(items, config):
selected, deselected_by_testcase = select_by_testcase(items)
selected, deselected_by_testcase = select_by_testcase(items, config)
selected, deselected_by_labels = select_by_labels(selected, config)

items[:] = selected
Expand Down

Back | FazBrowse Home | New Git URL