]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: drop --allow-fail and --no-collect-ok options 462/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 18 Dec 2022 19:14:16 +0000 (19:14 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 18 Dec 2022 19:14:16 +0000 (19:14 +0000)
They were needed to deal with problem caused by tox. Not needed anymore.

tests/conftest.py

index 9191e5769f20f3a25cd23327e12a37d039683461..15bcf4099ee11dd0ffc39a0f9c86e8022fcf9f50 100644 (file)
@@ -3,8 +3,6 @@ import asyncio
 import selectors
 from typing import List
 
-import pytest
-
 pytest_plugins = (
     "tests.fix_db",
     "tests.fix_pq",
@@ -41,22 +39,6 @@ def pytest_addoption(parser):
         help="The asyncio loop to use for async tests.",
     )
 
-    parser.addoption(
-        "--no-collect-ok",
-        action="store_true",
-        help=(
-            "If no test collected, exit with 0 instead of 5 (useful with --lfnf=none)."
-        ),
-    )
-
-    parser.addoption(
-        "--allow-fail",
-        metavar="NUM",
-        type=int,
-        default=0,
-        help="Tolerate up to NUM failures. Use carefully.",
-    )
-
 
 def pytest_report_header(config):
     rv = []
@@ -102,17 +84,6 @@ def pytest_sessionfinish(session, exitstatus):
     # Mark the test run successful (in the sense -weak- that we didn't segfault).
     session.config.cache.set("segfault", False)
 
-    no_collect_ok = session.config.getoption("--no-collect-ok")
-    if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED and no_collect_ok:
-        session.exitstatus = pytest.ExitCode.OK
-
-    allow_fail = session.config.getoption("--allow-fail")
-    if exitstatus == pytest.ExitCode.TESTS_FAILED:
-        if session.testsfailed <= allow_fail:
-            allow_fail_messages.append(f"Tests failed: {session.testsfailed}")
-            allow_fail_messages.append(f"Failures allowed: {allow_fail}")
-            session.exitstatus = pytest.ExitCode.OK
-
 
 def pytest_terminal_summary(terminalreporter, exitstatus, config):
     if allow_fail_messages: