diff --git a/tests/test_bot.py b/tests/test_bot.py index 5def9fabc5f..48d33e61223 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -1565,7 +1565,7 @@ def test_set_chat_description(self, bot, channel_id): # TODO: Add bot to group to test there too @flaky(3, 1) - @pytest.mark.timeout(10) + @pytest.mark.timeout(20) def test_pin_and_unpin_message(self, bot, super_group_id): message1 = bot.send_message(super_group_id, text="test_pin_message_1") message2 = bot.send_message(super_group_id, text="test_pin_message_2") @@ -1574,13 +1574,16 @@ def test_pin_and_unpin_message(self, bot, super_group_id): assert bot.pin_chat_message( chat_id=super_group_id, message_id=message1.message_id, disable_notification=True ) + time.sleep(1) bot.pin_chat_message( chat_id=super_group_id, message_id=message2.message_id, disable_notification=True ) + time.sleep(1) bot.pin_chat_message( chat_id=super_group_id, message_id=message3.message_id, disable_notification=True ) + time.sleep(1) chat = bot.get_chat(super_group_id) assert chat.pinned_message == message3 @@ -1834,7 +1837,7 @@ def test_copy_message_with_default(self, default_bot, chat_id, media_message): reply_to_message = default_bot.send_message(chat_id, 'test') reply_to_message.delete() if not default_bot.defaults.allow_sending_without_reply: - with pytest.raises(BadRequest, match='Reply message not found'): + with pytest.raises(BadRequest, match='not found'): default_bot.copy_message( chat_id, from_chat_id=chat_id, diff --git a/tests/test_photo.py b/tests/test_photo.py index f00c226fcfb..a4e7cf82c0a 100644 --- a/tests/test_photo.py +++ b/tests/test_photo.py @@ -63,7 +63,7 @@ class TestPhoto: width = 800 height = 800 caption = 'PhotoTest - *Caption*' - photo_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram_new.jpg' + photo_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.jpg' file_size = 29176 def test_creation(self, thumb, photo): @@ -81,12 +81,12 @@ def test_creation(self, thumb, photo): assert thumb.file_unique_id != '' def test_expected_values(self, photo, thumb): + # We used to test for file_size as well, but TG apparently at some point apparently changed + # the compression method and it's not really our job anyway ... assert photo.width == self.width assert photo.height == self.height - assert photo.file_size == self.file_size assert thumb.width == 320 assert thumb.height == 320 - assert thumb.file_size == 9331 @flaky(3, 1) @pytest.mark.timeout(10) @@ -191,9 +191,6 @@ def test_send_photo_caption_entities(self, bot, chat_id, photo_file, thumb, phot message = bot.send_photo( chat_id, photo_file, caption=test_string, caption_entities=entities ) - # message = bot.send_photo( - # chat_id, photo_file, caption=test_string, caption_entities=entities - # ) assert message.caption == test_string assert message.caption_entities == entities @@ -305,18 +302,16 @@ def test_send_url_jpg_file(self, bot, chat_id, thumb, photo): assert isinstance(message.photo[0].file_unique_id, str) assert message.photo[0].file_id != '' assert message.photo[0].file_unique_id != '' - assert message.photo[0].width == thumb.width - assert message.photo[0].height == thumb.height - assert message.photo[0].file_size == thumb.file_size + # We used to test for width, height and file_size, but TG apparently started to treat + # sending by URL and sending by upload differently and it's not really our job anyway ... assert isinstance(message.photo[1], PhotoSize) assert isinstance(message.photo[1].file_id, str) assert isinstance(message.photo[1].file_unique_id, str) assert message.photo[1].file_id != '' assert message.photo[1].file_unique_id != '' - assert message.photo[1].width == photo.width - assert message.photo[1].height == photo.height - assert message.photo[1].file_size == photo.file_size + # We used to test for width, height and file_size, but TG apparently started to treat + # sending by URL and sending by upload differently and it's not really our job anyway ... @flaky(3, 1) @pytest.mark.timeout(10)