mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-29 01:37:28 +01:00
Fix Test Failing Due To Telegram Updates (#2537)
* Update TestPhoto * try to fix test_idle again... * fix test_send_game due to photo size changes... Co-authored-by: Harshil <ilovebhagwan@gmail.com>
This commit is contained in:
parent
e2c6d60721
commit
cc43aef64b
3 changed files with 11 additions and 9 deletions
|
@ -1242,8 +1242,8 @@ class TestBot:
|
|||
)
|
||||
assert message.game.animation.file_id != ''
|
||||
# We added some test bots later and for some reason the file size is not the same for them
|
||||
# so we accept two different sizes here. Shouldn't be too much of
|
||||
assert message.game.photo[0].file_size in [851, 4928]
|
||||
# so we accept three different sizes here. Shouldn't be too much of
|
||||
assert message.game.photo[0].file_size in [851, 4928, 850]
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -60,8 +60,8 @@ def photo(_photo):
|
|||
|
||||
|
||||
class TestPhoto:
|
||||
width = 800
|
||||
height = 800
|
||||
width = 320
|
||||
height = 320
|
||||
caption = '<b>PhotoTest</b> - *Caption*'
|
||||
photo_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.jpg'
|
||||
file_size = 29176
|
||||
|
@ -85,8 +85,8 @@ class TestPhoto:
|
|||
# the compression method and it's not really our job anyway ...
|
||||
assert photo.width == self.width
|
||||
assert photo.height == self.height
|
||||
assert thumb.width == 320
|
||||
assert thumb.height == 320
|
||||
assert thumb.width == 90
|
||||
assert thumb.height == 90
|
||||
|
||||
@flaky(3, 1)
|
||||
def test_send_photo_all_args(self, bot, chat_id, photo_file, thumb, photo):
|
||||
|
@ -386,7 +386,7 @@ class TestPhoto:
|
|||
def test_resend(self, bot, chat_id, photo):
|
||||
message = bot.send_photo(chat_id=chat_id, photo=photo.file_id)
|
||||
|
||||
thumb, photo = message.photo
|
||||
thumb, photo, _ = message.photo
|
||||
|
||||
assert isinstance(message.photo[0], PhotoSize)
|
||||
assert isinstance(message.photo[0].file_id, str)
|
||||
|
|
|
@ -484,8 +484,10 @@ class TestUpdater:
|
|||
|
||||
# There is a chance of a conflict when getting updates since there can be many tests
|
||||
# (bots) running simultaneously while testing in github actions.
|
||||
if caplog.records[0].getMessage().startswith('Error while getting Updates: Conflict'):
|
||||
caplog.records.pop() # For stability
|
||||
for idx, log in enumerate(caplog.records):
|
||||
if log.getMessage().startswith('Error while getting Updates: Conflict'):
|
||||
caplog.records.pop(idx) # For stability
|
||||
assert len(caplog.records) == 2, caplog.records
|
||||
|
||||
rec = caplog.records[-2]
|
||||
assert rec.getMessage().startswith(f'Received signal {signal.SIGTERM}')
|
||||
|
|
Loading…
Add table
Reference in a new issue