Skip to content

Commit

Permalink
refactor: move verbosity check
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 6, 2024
1 parent 0c9e5f1 commit 81548db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/ape/pytest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ class ConfigWrapper(ManagerAccessMixin):

def __init__(self, pytest_config: "PytestConfig"):
self.pytest_config = pytest_config
if not self.verbosity:
# Enable verbose output if stdout capture is disabled
self.verbosity = self.pytest_config.getoption("capture") == "no"
# else: user has already changes verbosity to an equal or higher level; avoid downgrading.

@property
def verbosity(self) -> int:
return self.pytest_config.option.verbose

@verbosity.setter
def verbosity(self, value):
self.pytest_config.option.verbose = value

@cached_property
def supports_tracing(self) -> bool:
Expand Down
5 changes: 0 additions & 5 deletions src/ape/pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ def is_module(v):
except AttributeError:
pass

if not config.option.verbose:
# Enable verbose output if stdout capture is disabled
config.option.verbose = config.getoption("capture") == "no"
# else: user has already changes verbosity to an equal or higher level; avoid downgrading.

if "--help" in config.invocation_params.args:
# perf: Don't bother setting up runner if only showing help.
return
Expand Down

0 comments on commit 81548db

Please sign in to comment.