From 223dc14a8a63c97c6325ab4d9dc7bf1289a56529 Mon Sep 17 00:00:00 2001 From: r-spiewak <63987228+r-spiewak@users.noreply.github.com> Date: Thu, 19 Jun 2025 08:56:59 -0400 Subject: [PATCH] Add flag for checking output only if settings.debug_prints is True --- README.md | 2 +- tests/test_logger/test_logger.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d807c4..0b9ace1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,6 @@ Alternatively, set this template as an upstream branch and merge in changes acco 3. *Merge changes* (maybe do this on a branch other than main and make a PR into main): `git merge template/main -- allow-unrelated-histories` (for the main branch in the upstream template). 4. *Fix Merge Conflicts*: Fix the merge conflicts in your local branch. -However, both of these methods are messy (at least the first time), since the package name (`python_template`) changes, and (if the derived repo is created from the gitHub template) the merge will want to revert it back to `python_template` and put anything new into a `python_template` directory as well (since they don't have a shared history). +However, both of these methods are messy (seemingly every time, though much worse the first time), since the package name (`python_template`) changes, and (if the derived repo is created from the gitHub template) the merge will want to revert it back to `python_template` and put anything new into a `python_template` directory as well (since they don't have a shared history). The possible way to avoid this is if the derived repo is created locally as a copy of this repo, since then they'll have a shared history (and then the flag `--allow-unrelated-histories` in step 3 can be omitted as well). diff --git a/tests/test_logger/test_logger.py b/tests/test_logger/test_logger.py index 24f7030..971c8e7 100644 --- a/tests/test_logger/test_logger.py +++ b/tests/test_logger/test_logger.py @@ -5,6 +5,7 @@ from datetime import datetime from pathlib import Path +from python_template import settings from python_template.logger import LoggerMixin from python_template.logger.logger import DebugCategoryNameFilter @@ -23,8 +24,9 @@ def test_logger(capsys, test_class): out, _ = capsys.readouterr() using_key_text = "Using logger_key:" existing_key_text = "Existing keys in _loggers:" - assert using_key_text in out - assert existing_key_text in out + if settings.debug_prints: + assert using_key_text in out + assert existing_key_text in out def test_custom_logger(create_custom_test_class):