- Notifications
You must be signed in to change notification settings - Fork5.7k
Updated 3 failing tests of test_message.py.#4431
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Updated 3 failing tests of test_message.py.#4431
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The tests test_link_with_topics and test_link_with_reply were failing if beeing runned alone ( since message.chat.type was private).The test test_build_reply_arguments_chat_id_and_message_id was failing randomly, mostly when using pytest --lf (about 1 in 10 times). The reason was message.chat.username being set to 'username', so setting it to None will solve this problem.
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.
Thanks for the fix! I noticed this myself a couple of times before but didn't investigate the cause.
To elaborate further after investigation - part of the reason why it doesn't fail when the whole test file is run is because themessage
fixture is module scoped, and other tests are modifying that value (bad practice imo) which leads to a slightly different state for the next test. They fail individually because we initialize themessage
fixture with a private chat anyway, which doesn't have public links obviously.
I would suggest changing the scope of that fixture back to "function" (the default) to reduce the chance of this occuring in the future.
… value 'function'Removed setting of message.chat.username to None in test 'test_build_reply_arguments_chat_id_and_message_id' since it is no longer needed.executed multiple times 'pytest -m no_req -n auto --dist=loadgroup --lf' to validate all tests in test_message.py will still pass.
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.
lgtm. Ran it locally on my end and it passes.
fbf07bf
intopython-telegram-bot:masterUh oh!
There was an error while loading.Please reload this page.
Thank you for the contribution! |
The tests test_link_with_topics and test_link_with_reply were failing if beeing runned alone ( since message.chat.type was private).
The test test_build_reply_arguments_chat_id_and_message_id was failing randomly, mostly when using pytest --lf (about 1 in 10 times). The reason was message.chat.username being set to 'username', so setting it to None will solve this problem.