Skip to content

Commit

Permalink
Add --quiet back in
Browse files Browse the repository at this point in the history
Before this commit we could effectively disable logging by setting the
level to CRITICAL, but that only works because there are no CRITICAL
logs, and that isn't something we should expect users to know. This
feature is required by the use case in the datalad blog post
https://blog.datalad.org/posts/intro-duct-tion/
  • Loading branch information
asmacdo committed Aug 16, 2024
1 parent 029918c commit fda941a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_sanity_green(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
expected_files = [
Expand Down Expand Up @@ -56,6 +57,7 @@ def test_sanity_red(
clobber=False,
summary_format=EXECUTION_SUMMARY_FORMAT,
log_level="INFO",
quiet=False,
)
caplog.set_level("INFO")
assert execute(args) == exit_code
Expand Down Expand Up @@ -84,6 +86,7 @@ def test_outputs_full(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
expected_files = [
Expand All @@ -108,6 +111,7 @@ def test_outputs_passthrough(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
expected_files = [SUFFIXES["info"], SUFFIXES["usage"]]
Expand All @@ -129,6 +133,7 @@ def test_outputs_capture(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
# TODO make this work assert mock.call("this is of test of STDOUT\n") not in mock_stdout.write.mock_calls
Expand All @@ -155,6 +160,7 @@ def test_outputs_none(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
# assert mock.call("this is of test of STDOUT\n") not in mock_stdout.write.mock_calls
Expand All @@ -179,6 +185,7 @@ def test_outputs_none_quiet(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="ERROR",
quiet=False,
)
with mock.patch("sys.stderr", new_callable=mock.MagicMock) as mock_stderr:
assert execute(args) == 0
Expand All @@ -198,6 +205,7 @@ def test_exit_before_first_sample(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
expected_files = [
Expand All @@ -223,6 +231,7 @@ def test_run_less_than_report_interval(temp_output_dir: str) -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert execute(args) == 0
# Specifically we need to assert that usage.json gets written anyway.
Expand Down
3 changes: 3 additions & 0 deletions test/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_sample_less_than_report_interval() -> None:
summary_format="",
log_level="INFO",
clobber=False,
quiet=False,
)
assert args.sample_interval <= args.report_interval

Expand All @@ -33,6 +34,7 @@ def test_sample_equal_to_report_interval() -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)
assert args.sample_interval == args.report_interval

Expand All @@ -51,6 +53,7 @@ def test_sample_equal_greater_than_report_interval() -> None:
clobber=False,
summary_format="",
log_level="INFO",
quiet=False,
)


Expand Down

0 comments on commit fda941a

Please sign in to comment.