fix: guard LOG_FILE_PATH against handlers without baseFilename (fixes #131)#134
Open
charlesaurav13 wants to merge 1 commit into
Open
fix: guard LOG_FILE_PATH against handlers without baseFilename (fixes #131)#134charlesaurav13 wants to merge 1 commit into
charlesaurav13 wants to merge 1 commit into
Conversation
…name Fixes BusKill#131. pytest replaces the root log handler with _LiveLoggingNullHandler, which has no baseFilename attribute. The bare attribute access on line 227 raised AttributeError on every test run, making BusKill completely untestable under pytest. Use getattr with a None default so BusKill can be instantiated safely in any logging environment, including pytest's. Signed-off-by: charlesaurav13 <sauravp1236@gmail.com>
|
INFO: No unicode characters found in PR's commits (source) |
Member
|
Thanks for the PR :) Please note that this repo does not accept contributions that use AI Can you please tell us if you wrote this code, comments, and PR contents entirely by yourself? Or if you used AI for any part of it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BusKill.__init__hard-codedlogger.root.handlers[0].baseFilenameon line 227_LiveLoggingNullHandler, which has nobaseFilenameattribute, so every test that instantiatesBusKill()crashed withAttributeErrorgetattr(handler, 'baseFilename', None)and also guarding against an empty handlers listChanges
src/packages/buskill/__init__.pyline 227:Test plan
BusKill()inside a pytest test — no longer raisesAttributeErrorLOG_FILE_PATHstill resolves to the log file path when aFileHandleris configuredCloses #131