Skip to content

Conversation

@Kahreiru
Copy link
Collaborator

@Kahreiru Kahreiru commented Oct 20, 2025

Issue with test opening MainWindow using
MainWIndow.show()
without running the corresponding
MainWindow.close()

Summary by Sourcery

Close MainWindow after tests to prevent segmentation faults and re-enable Qt debug plugins and Python fault handler in the CI workflow

Bug Fixes:

  • Close MainWindow in pytest fixture teardown to prevent segmentation faults

CI:

  • Enable QT_DEBUG_PLUGINS and PYTHONFAULTHANDLER environment variables in CI workflow

Tests:

  • Convert TestStructureTab fixture to use yield and add teardown to close MainWindow

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 20, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Convert the test_object helper into a pytest yield fixture to ensure MainWindow is closed after each test, and enable CI debug flags for Qt plugins and Python fault handling.

Sequence diagram for test fixture setup and teardown of MainWindow

sequenceDiagram
    participant Test as "pytest test"
    participant Fixture as "test_object_fixture"
    participant Window as "MainWindow"
    Test->>Fixture: request fixture
    Fixture->>Window: show()
    Test-->>Fixture: run test
    Fixture->>Window: close()
    Fixture->>Fixture: nullify main_window
    Fixture->>Fixture: invoke garbage collection
Loading

Class diagram for updated test fixture handling MainWindow

classDiagram
    class test_object_fixture {
        +MainWindow main_window
        +setup: show main_window
        +teardown: close main_window, nullify main_window, invoke gc
    }
    test_object_fixture --> MainWindow
Loading

File-Level Changes

Change Details Files
Convert test_object to pytest yield fixture ensuring MainWindow closure
  • Change test_object to yield the TestStructureTab instance
  • Add teardown step to close main_window after each test
test/test_view_structures_tab.py
Enable CI debugging flags for Qt plugins and Python fault handler
  • Uncomment export QT_DEBUG_PLUGINS=1
  • Uncomment export PYTHONFAULTHANDLER=1
.github/workflows/pythonapp.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Kahreiru Kahreiru changed the title fFxing segfault cause by test showing window but not closing window Fxing segfault cause by test showing window but not closing window Oct 20, 2025
@Kahreiru
Copy link
Collaborator Author

L:ooks like i fixed one segfault and ended up with another one

@Kahreiru Kahreiru marked this pull request as ready for review October 20, 2025 07:30
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Kahreiru Kahreiru closed this Oct 22, 2025
@Kahreiru Kahreiru deleted the fixingSegFault branch October 22, 2025 11:53
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.

1 participant