From 30436777f65d933e1df1a910758f9744ce11c750 Mon Sep 17 00:00:00 2001 From: Yusuke Kadowaki Date: Sun, 23 Oct 2022 01:03:40 +0900 Subject: [PATCH] Add retention cli options frontend --- src/_pytest/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 61fb7eaa4..79a24632b 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -228,6 +228,22 @@ def pytest_addoption(parser: Parser) -> None: ), ) + group.addoption( + "--tmp-path-retention-count", + dest="tmp_path_retention_count", + default=3, + metavar="num", + help="How many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.", + ) + + group.addoption( + "--tmp-path-retention-policy", + default="failed", + choices=["all", "failed", "none"], + dest="tmp_path_retention_policy", + help="Controls which directories created by the `tmp_path` fixture are kept around, based on test outcome.", + ) + def validate_basetemp(path: str) -> str: # GH 7119