Skip to content

Commit

Permalink
use detect_pytest() instead of duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
niradar committed Jun 17, 2024
1 parent 9cfb575 commit 216b9b6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions duplicate_files_in_folders/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def setup_logging():
Only errors (and above) are logged to the console.
:return: None
"""
is_test = 'PYTEST_CURRENT_TEST' in os.environ
formatter = logging.Formatter('[%(levelname)s]\t%(asctime)s:\t%(message)s')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
Expand All @@ -24,7 +23,7 @@ def setup_logging():
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)

if not is_test:
if not detect_pytest():
# create logs folder if it doesn't exist
base_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
logs_folder = os.path.join(base_folder, 'logs')
Expand Down

0 comments on commit 216b9b6

Please sign in to comment.