()
| 98 | |
| 99 | @pytest.hookimpl(hookwrapper=True) |
| 100 | def pytest_cmdline_parse(): |
| 101 | outcome = yield |
| 102 | config: Config = outcome.get_result() |
| 103 | |
| 104 | if config.option.debug: |
| 105 | # --debug | --debug <file.log> was provided. |
| 106 | path = config.option.debug |
| 107 | debugfile = open(path, "w") |
| 108 | debugfile.write( |
| 109 | "versions pytest-%s, " |
| 110 | "python-%s\ncwd=%s\nargs=%s\n\n" |
| 111 | % ( |
| 112 | pytest.__version__, |
| 113 | ".".join(map(str, sys.version_info)), |
| 114 | os.getcwd(), |
| 115 | config.invocation_params.args, |
| 116 | ) |
| 117 | ) |
| 118 | config.trace.root.setwriter(debugfile.write) |
| 119 | undo_tracing = config.pluginmanager.enable_tracing() |
| 120 | sys.stderr.write("writing pytest debug information to %s\n" % path) |
| 121 | |
| 122 | def unset_tracing() -> None: |
| 123 | debugfile.close() |
| 124 | sys.stderr.write("wrote pytest debug information to %s\n" % debugfile.name) |
| 125 | config.trace.root.setwriter(None) |
| 126 | undo_tracing() |
| 127 | |
| 128 | config.add_cleanup(unset_tracing) |
| 129 | |
| 130 | |
| 131 | def showversion(config: Config) -> None: |
nothing calls this directly
no test coverage detected