Skip to content

Commit

Permalink
Merge branch 'master' into Derra_Branch
Browse files Browse the repository at this point in the history
  • Loading branch information
DarianTheGoat1 authored Jun 23, 2024
2 parents db00c72 + d662625 commit a7af0b2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nikola/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def configure_logging(logging_mode: LoggingMode = LoggingMode.NORMAL) -> None:

def print_coverage_configure():
for branch, hit in branch_coverage_configure.items():
print(f"configure {branch} was {'hit' if hit else 'not hit'}")
print(f"configure {branch} was {'hit' if hit else 'not hit'}")

def reset_coverage_configure():
for key in branch_coverage_configure:
branch_coverage_configure[key] = False
Expand Down
38 changes: 38 additions & 0 deletions tests/test_configure_logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from nikola.log import configure_logging, print_coverage_configure, reset_coverage_configure, LoggingMode
from unittest.mock import patch


def test_normal_mode_debug():
reset_coverage_configure()
with patch('nikola.log.DEBUG', True):
configure_logging(logging_mode=LoggingMode.NORMAL)
print_coverage_configure()


def test_normal_mode_no_debug():
reset_coverage_configure()
configure_logging(logging_mode=LoggingMode.NORMAL)
print_coverage_configure()


def test_quiet_mode_debug():
reset_coverage_configure()
with patch('nikola.log.DEBUG', True):
configure_logging(logging_mode=LoggingMode.QUIET)
print_coverage_configure()

def test_quiet_mode_no_debug():
reset_coverage_configure()
configure_logging(logging_mode=LoggingMode.QUIET)
print_coverage_configure()

def test_strict_mode_debug():
reset_coverage_configure()
with patch('nikola.log.DEBUG', True):
configure_logging(logging_mode=LoggingMode.STRICT)
print_coverage_configure()

def test_strict_mode_no_debug():
reset_coverage_configure()
configure_logging(logging_mode=LoggingMode.STRICT)
print_coverage_configure()

0 comments on commit a7af0b2

Please sign in to comment.