Skip to content

Commit 8a33ce7

Browse files
jcfrmrbean-bremen
authored andcommitted
tests: Update PythonQtTestCleanup to test alternative cleanup order
This adds a new test to PythonQtTestCleanup to verify behavior when Python is finalized before PythonQt cleanup is called.
1 parent bda8783 commit 8a33ce7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/PythonQtTestCleanup.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ void PythonQtTestCleanup::testSignalReceiverCleanup()
8989
));
9090
}
9191

92+
void PythonQtTestCleanup::testPyFinalizeThenPythonQtCleanup()
93+
{
94+
if (Py_IsInitialized()) {
95+
Py_Finalize();
96+
}
97+
98+
PythonQt::cleanup();
99+
}
100+
92101
bool PythonQtTestCleanupHelper::runScript(const char* script)
93102
{
94103
_passed = false;

tests/PythonQtTestCleanup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ private Q_SLOTS:
2020
void testCallQtMethodInDestructorOwnedQTimer();
2121
void testCallQtMethodInDestructorWeakRefGuarded();
2222
void testSignalReceiverCleanup();
23+
void testPyFinalizeThenPythonQtCleanup();
2324

2425
private:
2526
PythonQtTestCleanupHelper* _helper;

0 commit comments

Comments
 (0)