Example #1
0
def check_xfail_no_run(item):
    """check xfail(run=False)"""
    if not item.config.option.runxfail:
        evalxfail = item._evalxfail
        if evalxfail.istrue():
            if not evalxfail.get("run", True):
                xfail("[NOTRUN] " + evalxfail.getexplanation())
Example #2
0
def check_xfail_no_run(item):
    """check xfail(run=False)"""
    if not item.config.option.runxfail:
        evalxfail = item._store[evalxfail_key]
        if evalxfail.istrue():
            if not evalxfail.get("run", True):
                xfail("[NOTRUN] " + evalxfail.getexplanation())
def pytest_runtest_setup(item: Item) -> None:
    skipped = evaluate_skip_marks(item)
    if skipped:
        raise skip.Exception(skipped.reason, _use_item_location=True)

    item.stash[xfailed_key] = xfailed = evaluate_xfail_marks(item)
    if xfailed and not item.config.option.runxfail and not xfailed.run:
        xfail("[NOTRUN] " + xfailed.reason)
Example #4
0
def pytest_runtest_setup(item: Item) -> None:
    skipped = evaluate_skip_marks(item)
    item._store[skipped_by_mark_key] = skipped is not None
    if skipped:
        skip(skipped.reason)

    item._store[xfailed_key] = xfailed = evaluate_xfail_marks(item)
    if xfailed and not item.config.option.runxfail and not xfailed.run:
        xfail("[NOTRUN] " + xfailed.reason)
 def addExpectedFailure(
     self,
     testcase: "unittest.TestCase",
     rawexcinfo: "_SysExcInfoType",
     reason: str = "",
 ) -> None:
     try:
         xfail(str(reason))
     except xfail.Exception:
         self._addexcinfo(sys.exc_info())
Example #6
0
def pytest_runtest_call(item: Item) -> Generator[None, None, None]:
    xfailed = item._store.get(xfailed_key, None)
    if xfailed is None:
        item._store[xfailed_key] = xfailed = evaluate_xfail_marks(item)

    if not item.config.option.runxfail:
        if xfailed and not xfailed.run:
            xfail("[NOTRUN] " + xfailed.reason)

    yield
def pytest_runtest_call(item: Item) -> Generator[None, None, None]:
    xfailed = item.stash.get(xfailed_key, None)
    if xfailed is None:
        item.stash[xfailed_key] = xfailed = evaluate_xfail_marks(item)

    if xfailed and not item.config.option.runxfail and not xfailed.run:
        xfail("[NOTRUN] " + xfailed.reason)

    yield

    # The test run may have added an xfail mark dynamically.
    xfailed = item.stash.get(xfailed_key, None)
    if xfailed is None:
        item.stash[xfailed_key] = xfailed = evaluate_xfail_marks(item)
Example #8
0
 def addExpectedFailure(self, testcase, rawexcinfo, reason=""):
     try:
         xfail(str(reason))
     except xfail.Exception:
         self._addexcinfo(sys.exc_info())
Example #9
0
 def addExpectedFailure(self, testcase, rawexcinfo, reason=""):
     try:
         xfail(str(reason))
     except xfail.Exception:
         self._addexcinfo(sys.exc_info())