-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass program name to QApplication contructor #515
Conversation
Is this related to #483 somehow? |
""" | ||
return [] | ||
return [pytestconfig.getini("qt_qapp_name")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #483, this should be sys.argv[0]
instead. The QApplication.applicationName()
isn't necessarily the same thing.
Looks like it is, and should probably close that issue? This definitely needs a changelog entry and a test as well though. |
Right, but |
True, but I'd argue that is the correct value. The whole point of |
66a4227
to
144a96e
Compare
@The-Compiler OK fine! I'll then keep the original version for now, if it is ok?
Added a unit test. |
@The-Compiler Should I add an entry in the changelog in this PR, or should it be a separate PR? |
Same PR, thanks! |
QCommandLineParser needs QApplication to be initialized with at list one argument: The name of the program.
Added a unit test to test qapp_args default value
@nicoddemus In |
I think it does work, but the linter pytest-qt/.pre-commit-config.yaml Line 45 in da33817
does not see the whole picture? |
Is it possible to make the linter somehow ignore this line with |
@hakonhagland hmm I don't think it is possible to configure the linter that way, perhaps we can exclude
Let's remove |
144a96e
to
ac5155c
Compare
Ok done! Please review last commit for changelog update |
CHANGELOG.rst
Outdated
4.3.0 (2023-09-20) | ||
------------------ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably won't have an immediate release, but even so the process is to set version/date at the time of release. 👍
4.3.0 (2023-09-20) | |
------------------ | |
UNRELEASED | |
---------- |
tests/test_basics.py
Outdated
# testdir.makeini( | ||
# """ | ||
# [pytest] | ||
# qt_qapp_name = frobnicator | ||
# """ | ||
# ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# testdir.makeini( | |
# """ | |
# [pytest] | |
# qt_qapp_name = frobnicator | |
# """ | |
# ) |
Do you have a strong opinion on this @hakonhagland? |
Mark changelog update as unreleased
Do you mean whether to use |
Yes, I'm kind leaning towards @The-Compiler 's original opinion of using But only if you do not have a strong opinion on this. |
I think the QApplication should not depend on the location of the |
Hmm not sure what you mean,
Not sure about what what some tests might need hypothetically, can't think of a situation where someone wants to check the first argument passed to Another point is that the the recommendation in production code is to pass |
@nicoddemus I think this is for code running normally, not for code being executed by another program like pytest. Therefore it will be safe and also the correct approach to pass application name instead of the location of the pytest script (that is: sys.argv[0]) |
I'm not entirely convinced but TBH I'm not sure this will really matter much in the end, so I'm fine with we going in that direction. 👍 Letting @The-Compiler do another round of review/merge. 👍 Thanks again @hakonhagland for the contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good all in all! Not sure what's up with the failing CI environments, and no time right now to dig into that.
8d0d48d
They are all related to pyside6 and unrelated to this PR, except for the pre-commit job:
Just pushed a fix to that one. |
Thanks @hakonhagland! |
QCommandLineParser
needsQApplication
to be initialized with a list with at least one argument: The name of the program.See #514 (comment) for an example.
Closes #483.