Skip to content

Commit

Permalink
testing: add --papis-enable-logging flag
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed May 18, 2024
1 parent 0250504 commit f904507
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions papis/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ def test_me(resource_cache: ResourceCache) -> None:


def pytest_addoption(parser: Parser) -> None:
parser.addoption("--papis-enable-logging", action="store_true",
help="Enable logging while running tests")
parser.addoption("--papis-tmp-doctests", action="store_true",
help="Use a temporary configuration file for doctests")
parser.addoption("--papis-tmp-xdg-home", action="store_true",
Expand All @@ -627,6 +629,10 @@ def pytest_configure(config: Config) -> None:
# here first to avoid them picking up any sort of user configuration.
os.environ["XDG_CONFIG_HOME"] = tempfile.gettempdir()

if config.getoption("--papis-enable-logging"):
import papis.logging
papis.logging.setup()

config.addinivalue_line(
"markers",
"config_setup(**kwargs): pass kwargs to TemporaryConfiguration initialization")
Expand Down

0 comments on commit f904507

Please sign in to comment.