@@ -67,6 +67,13 @@ def __init__(self, message):
6767
6868
6969def pytest_load_initial_conftests (early_config , parser , args ): # noqa: ARG001
70+ has_pytest_cov = early_config .pluginmanager .hasplugin ("pytest_cov" )
71+ has_cov_arg = any ("--cov" in arg for arg in args )
72+ if has_cov_arg and not has_pytest_cov :
73+ raise VSCodePytestError (
74+ "\n \n ERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. \n "
75+ )
76+
7077 global TEST_RUN_PIPE
7178 TEST_RUN_PIPE = os .getenv ("TEST_RUN_PIPE" )
7279 error_string = (
@@ -117,6 +124,7 @@ def pytest_internalerror(excrepr, excinfo): # noqa: ARG001
117124 excinfo -- the exception information of type ExceptionInfo.
118125 """
119126 # call.excinfo.exconly() returns the exception as a string.
127+ print ("UGHHHHHH2" )
120128 ERRORS .append (excinfo .exconly () + "\n Check Python Test Logs for more details." )
121129
122130
@@ -131,6 +139,8 @@ def pytest_exception_interact(node, call, report):
131139 # call.excinfo is the captured exception of the call, if it raised as type ExceptionInfo.
132140 # call.excinfo.exconly() returns the exception as a string.
133141 # If it is during discovery, then add the error to error logs.
142+ print ("UGHHHHHH23" )
143+
134144 if IS_DISCOVERY :
135145 if call .excinfo and call .excinfo .typename != "AssertionError" :
136146 if report .outcome == "skipped" and "SkipTest" in str (call ):
@@ -935,6 +945,10 @@ def pytest_xdist_auto_num_workers(
935945
936946
937947def pytest_plugin_registered (plugin : object , manager : pytest .PytestPluginManager ):
948+ # if manager.has_plugin("pytest_cov"):
949+ # print("has plugin cov pytest")
950+ # else:
951+ # print("does not have plugin cov pytest")
938952 plugin_name = "vscode_xdist"
939953 if (
940954 # only register the plugin if xdist is enabled:
0 commit comments