(fixturedef: FixtureDef[object], msg: str)
| 58 | |
| 59 | |
| 60 | def _show_fixture_action(fixturedef: FixtureDef[object], msg: str) -> None: |
| 61 | config = fixturedef._fixturemanager.config |
| 62 | capman = config.pluginmanager.getplugin("capturemanager") |
| 63 | if capman: |
| 64 | capman.suspend_global_capture() |
| 65 | |
| 66 | tw = config.get_terminal_writer() |
| 67 | tw.line() |
| 68 | # Use smaller indentation the higher the scope: Session = 0, Package = 1, etc. |
| 69 | scope_indent = list(reversed(Scope)).index(fixturedef._scope) |
| 70 | tw.write(" " * 2 * scope_indent) |
| 71 | tw.write( |
| 72 | "{step} {scope} {fixture}".format( |
| 73 | step=msg.ljust(8), # align the output to TEARDOWN |
| 74 | scope=fixturedef.scope[0].upper(), |
| 75 | fixture=fixturedef.argname, |
| 76 | ) |
| 77 | ) |
| 78 | |
| 79 | if msg == "SETUP": |
| 80 | deps = sorted(arg for arg in fixturedef.argnames if arg != "request") |
| 81 | if deps: |
| 82 | tw.write(" (fixtures used: {})".format(", ".join(deps))) |
| 83 | |
| 84 | if hasattr(fixturedef, "cached_param"): |
| 85 | tw.write(f"[{saferepr(fixturedef.cached_param, maxsize=42)}]") # type: ignore[attr-defined] |
| 86 | |
| 87 | tw.flush() |
| 88 | |
| 89 | if capman: |
| 90 | capman.resume_global_capture() |
| 91 | |
| 92 | |
| 93 | @pytest.hookimpl(tryfirst=True) |
no test coverage detected