MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / pytest_unconfigure

Function pytest_unconfigure

seleniumbase/plugins/pytest_plugin.py:2717–2767  ·  view source on GitHub ↗

This runs after all tests have completed with pytest.

(config)

Source from the content-addressed store, hash-verified

2715
2716
2717def pytest_unconfigure(config):
2718 """This runs after all tests have completed with pytest."""
2719 if "--co" in sys_argv or "--collect-only" in sys_argv:
2720 return
2721 reporter = config.pluginmanager.get_plugin("terminalreporter")
2722 if (
2723 not hasattr(reporter, "_session_start")
2724 or (
2725 hasattr(reporter, "_session_start")
2726 and not hasattr(reporter._session_start, "time")
2727 )
2728 ):
2729 return
2730 if getattr(sb_config, "_multithreaded", None):
2731 import fasteners
2732
2733 dash_lock = fasteners.InterProcessLock(constants.Dashboard.LOCKFILE)
2734 if getattr(sb_config, "dashboard", None):
2735 # Multi-threaded tests with the Dashboard
2736 abs_path = os.path.abspath(".")
2737 dash_lock_file = constants.Dashboard.LOCKFILE
2738 dash_lock_path = os.path.join(abs_path, dash_lock_file)
2739 if os.path.exists(dash_lock_path):
2740 sb_config._only_unittest = False
2741 dashboard_path = os.path.join(abs_path, "dashboard.html")
2742 with dash_lock:
2743 if (
2744 sb_config._dash_html
2745 and config.getoption("htmlpath") == "dashboard.html"
2746 ):
2747 # Dash is HTML Report (Multithreaded)
2748 sb_config._dash_is_html_report = True
2749 with open(
2750 dashboard_path, mode="w", encoding="utf-8"
2751 ) as f:
2752 f.write(sb_config._dash_html)
2753 # Dashboard Multithreaded
2754 _perform_pytest_unconfigure_(config)
2755 return
2756 else:
2757 # Dash Lock is missing
2758 _perform_pytest_unconfigure_(config)
2759 return
2760 with dash_lock:
2761 # Multi-threaded tests
2762 _perform_pytest_unconfigure_(config)
2763 return
2764 else:
2765 # Single-threaded tests
2766 _perform_pytest_unconfigure_(config)
2767 return
2768
2769
2770@pytest.fixture()

Callers

nothing calls this directly

Calls 2

writeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…