Skip to content

Conversation

@miquelbeltran
Copy link
Contributor

Description 📝

Purpose:

Attempting to reproduce the error reported in #98 I've created a couple of unit tests. I couldn't reproduce the issue, but I think the tests are helpful anyway so adding them to the codebase.

Approach:

Added unit tests for RaygunHandler, one that verifies the calling arguments for send_exception and one that adds a simple test using logger.exception(...) outside an exception context

Type of change

  • fix: Bug fix (non-breaking change which fixes an issue)
  • feat: New feature (non-breaking change which adds functionality)
  • chore: Chore task, release or small impact change
  • ci: CI configuration change
  • Other type of change (specify)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Updates

  • Adds tests

Related issues

Test plan 🧪

  • Run unit tests locally

Author to check 👓

  • Project and all contained modules builds successfully
  • Self-/dev-tested
  • Unit/UI/Automation/Integration tests provided where applicable
  • Code is written to standards
  • Appropriate documentation written (code comments, internal docs)

Reviewer to check ✔️

  • Project and all contained modules builds successfully
  • Change has been dev-/reviewer-tested, where possible
  • Unit/UI/Automation/Integration tests provided where applicable
  • Code is written to standards
  • Appropriate documentation written (code comments, internal docs)

@miquelbeltran miquelbeltran requested a review from Copilot May 22, 2025 06:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds unit tests to cover RaygunHandler behavior when logging outside an exception context.

  • Introduces a new TestRaygunHandler test class that mocks send_exception and verifies fallback parameters.
  • Adds a functional test to ensure logging without an exception does not raise errors.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
python3/tests/test_raygunprovider.py Added TestRaygunHandler to verify send_exception calls and fallback error handling
python3/tests/test_functional.py Added test_logger_without_exception to ensure error logging runs without exceptions
Comments suppressed due to low confidence (2)

python3/tests/test_functional.py:179

  • [nitpick] Variable rgHandler uses camelCase; consider renaming to rg_handler to follow Python's snake_case naming convention.
rgHandler = raygunprovider.RaygunHandler(self.apiKey)

python3/tests/test_raygunprovider.py:213

  • The name raygunprovider is not imported in this file, which will cause a NameError. Add an import such as from raygun4py import raygunprovider at the top.
self.handler = raygunprovider.RaygunHandler("testkey", "v1.0")

Copy link

@Olwiba Olwiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@miquelbeltran
Copy link
Contributor Author

Thanks!

@miquelbeltran miquelbeltran merged commit afdf001 into master Jun 2, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RaygunHandler fails when logging outside of an exception context.

3 participants