pytest-qt
pytest-qt copied to clipboard
Missing organization name on qapp breaks tests with QSettings
I've stumbled across an issue this morning with running tests that use QSettings.
The qapp fixture does have a default value and a config setting for the application name. Nevertheless, it has none for the organization name. Both of them are required for QSettings to work (see https://doc.qt.io/qt-5/qsettings.html#basic-usage).
I'm still not sure, what went wrong since the qapp fixture is requested in my tests AFTER I wrote values to QSettings in earlier fixtures, but when I add the organization name in the qapp fixture, my tests work. I need to figure this out. Anyway: Is there are reason, that a name is set for the application, but none for the organization?
Hi @TilmanK,
I'm still not sure, what went wrong since the qapp fixture is requested in my tests AFTER I wrote values to QSettings in earlier fixtures, but when I add the organization name in the qapp fixture, my tests work.
Not sure either, I personally never used QSettings
so I couldn't say.
Anyway: Is there are reason, that a name is set for the application, but none for the organization?
Not that I'm aware of.
Hi @TilmanK,
I'm still not sure, what went wrong since the qapp fixture is requested in my tests AFTER I wrote values to QSettings in earlier fixtures, but when I add the organization name in the qapp fixture, my tests work.
Not sure either, I personally never used
QSettings
so I couldn't say.
I am now. I've set the application name AFTER I ran some fixtures that already accessed QSettings.
Anyway: Is there are reason, that a name is set for the application, but none for the organization?
Not that I'm aware of.
Ok, I'd prepare a PR if you or anyone else doesn't have any obligation.
Looks like fc1faad0c3fe76610b46c16822618ea7ff2a4662 doesn't have much context - I think the only reason I didn't do so is that I wasn't aware of anything which requires the organization name to be set. So please go ahead!