Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix LOG_FILE_PATH initialization under pytest#133

Open
Raihan93-coder wants to merge 1 commit into
BusKill:dev from
Raihan93-coder:fix-pytest-logging-clean
Open

Fix LOG_FILE_PATH initialization under pytest #133
Raihan93-coder wants to merge 1 commit into
BusKill:dev from
Raihan93-coder:fix-pytest-logging-clean

Conversation

@Raihan93-coder

@Raihan93-coder Raihan93-coder commented Jun 16, 2026

Copy link
Copy Markdown

Pytest logging

This solves the issue raised in #131.

Problem

When BusKill is instantiated under pytest, logger.root.handlers[0] may be a _LiveLoggingNullHandler. Unlike a normal FileHandler, this object does not provide a baseFilename attribute, causing:

AttributeError: _LiveLoggingNullHandler object has no attribute baseFilename

The previous fix introduced in #121 prevented an IndexError when no handlers were present, but it did not handle logging handlers that lack a baseFilename attribute.

Solution

Use getattr() when retrieving baseFilename and handle the case where no handlers are present. ( Solution given by @prashanth-kaki )

This prevents both:

IndexError when logger.root.handlers is empty. ( In the PR #121 )
AttributeError when the active logging handler does not provide baseFilename. ( Implemented in this PR )

Testing

Reproduced on:

Parrot Security 6.4 (Debian 12 based OS)
Python 3.13.9
pytest 9.1.0

Verified that BusKill() can now be instantiated successfully under pytest without raising an exception 🤓

A small error has happened so I am opening this new PR instead of #132 😞

Copy link
Copy Markdown

INFO: No unicode characters found in PR's commits

(source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /