diff options
Diffstat (limited to 'dev-python/python-telegram-bot/files')
| -rw-r--r-- | dev-python/python-telegram-bot/files/python-telegram-bot-20.5-no-internet-tests.patch | 324 |
1 files changed, 324 insertions, 0 deletions
diff --git a/dev-python/python-telegram-bot/files/python-telegram-bot-20.5-no-internet-tests.patch b/dev-python/python-telegram-bot/files/python-telegram-bot-20.5-no-internet-tests.patch new file mode 100644 index 000000000000..41c9840ed60c --- /dev/null +++ b/dev-python/python-telegram-bot/files/python-telegram-bot-20.5-no-internet-tests.patch @@ -0,0 +1,324 @@ +diff --git a/tests/_files/test_animation.py b/tests/_files/test_animation.py +index 23ec3b50..a7230495 100644 +--- a/tests/_files/test_animation.py ++++ b/tests/_files/test_animation.py +@@ -65,6 +65,7 @@ class TestAnimationBase: + + + class TestAnimationWithoutRequest(TestAnimationBase): ++ __test__ = False + def test_slot_behaviour(self, animation): + for attr in animation.__slots__: + assert getattr(animation, attr, "err") != "err", f"got extra slot '{attr}'" +diff --git a/tests/_files/test_audio.py b/tests/_files/test_audio.py +index 3ea394d0..6a7c47e4 100644 +--- a/tests/_files/test_audio.py ++++ b/tests/_files/test_audio.py +@@ -66,6 +66,7 @@ class TestAudioBase: + + + class TestAudioWithoutRequest(TestAudioBase): ++ __test__ = False + def test_slot_behaviour(self, audio): + for attr in audio.__slots__: + assert getattr(audio, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -196,6 +197,7 @@ class TestAudioWithoutRequest(TestAudioBase): + + + class TestAudioWithRequest(TestAudioBase): ++ __test__ = False + async def test_send_all_args(self, bot, chat_id, audio_file, thumb_file): + message = await bot.send_audio( + chat_id, +diff --git a/tests/_files/test_chatphoto.py b/tests/_files/test_chatphoto.py +index d09876e2..65c3e213 100644 +--- a/tests/_files/test_chatphoto.py ++++ b/tests/_files/test_chatphoto.py +@@ -61,6 +61,7 @@ class TestChatPhotoBase: + + + class TestChatPhotoWithoutRequest(TestChatPhotoBase): ++ __test__ = False + def test_slot_behaviour(self, chat_photo): + for attr in chat_photo.__slots__: + assert getattr(chat_photo, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -155,6 +156,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase): + + + class TestChatPhotoWithRequest: ++ __test__ = False + async def test_get_and_download(self, bot, chat_photo, tmp_file): + tasks = {bot.get_file(chat_photo.small_file_id), bot.get_file(chat_photo.big_file_id)} + asserts = [] +diff --git a/tests/_files/test_document.py b/tests/_files/test_document.py +index f5ccdbeb..f22cef77 100644 +--- a/tests/_files/test_document.py ++++ b/tests/_files/test_document.py +@@ -61,6 +61,7 @@ class TestDocumentBase: + + + class TestDocumentWithoutRequest(TestDocumentBase): ++ __test__ = False + def test_slot_behaviour(self, document): + for attr in document.__slots__: + assert getattr(document, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -190,6 +191,7 @@ class TestDocumentWithoutRequest(TestDocumentBase): + + + class TestDocumentWithRequest(TestDocumentBase): ++ __test__ = False + async def test_error_send_empty_file(self, bot, chat_id): + with Path(os.devnull).open("rb") as f, pytest.raises(TelegramError): + await bot.send_document(chat_id=chat_id, document=f) +diff --git a/tests/_files/test_inputmedia.py b/tests/_files/test_inputmedia.py +index f00dd165..bb4252f4 100644 +--- a/tests/_files/test_inputmedia.py ++++ b/tests/_files/test_inputmedia.py +@@ -179,6 +179,7 @@ class TestInputMediaVideoWithoutRequest(TestInputMediaVideoBase): + assert input_media_video_dict["supports_streaming"] == input_media_video.supports_streaming + assert input_media_video_dict["has_spoiler"] == input_media_video.has_spoiler + ++ @pytest.mark.skip(reason="Requires internet connection") + def test_with_video(self, video): # noqa: F811 + # fixture found in test_video + input_media_video = InputMediaVideo(video, caption="test 3") +@@ -242,7 +243,8 @@ class TestInputMediaPhotoWithoutRequest(TestInputMediaPhotoBase): + ce.to_dict() for ce in input_media_photo.caption_entities + ] + assert input_media_photo_dict["has_spoiler"] == input_media_photo.has_spoiler +- ++ ++ @pytest.mark.skip(reason="Requires internet connection") + def test_with_photo(self, photo): # noqa: F811 + # fixture found in test_photo + input_media_photo = InputMediaPhoto(photo, caption="test 2") +@@ -307,7 +309,8 @@ class TestInputMediaAnimationWithoutRequest(TestInputMediaAnimationBase): + assert input_media_animation_dict["height"] == input_media_animation.height + assert input_media_animation_dict["duration"] == input_media_animation.duration + assert input_media_animation_dict["has_spoiler"] == input_media_animation.has_spoiler +- ++ ++ @pytest.mark.skip(reason="Requires internet connection") + def test_with_animation(self, animation): # noqa: F811 + # fixture found in test_animation + input_media_animation = InputMediaAnimation(animation, caption="test 2") +@@ -375,7 +378,8 @@ class TestInputMediaAudioWithoutRequest(TestInputMediaAudioBase): + assert input_media_audio_dict["caption_entities"] == [ + ce.to_dict() for ce in input_media_audio.caption_entities + ] +- ++ ++ @pytest.mark.skip(reason="Requires internet connection") + def test_with_audio(self, audio): # noqa: F811 + # fixture found in test_audio + input_media_audio = InputMediaAudio(audio, caption="test 3") +@@ -447,6 +451,7 @@ class TestInputMediaDocumentWithoutRequest(TestInputMediaDocumentBase): + == input_media_document.disable_content_type_detection + ) + ++ @pytest.mark.skip(reason="Requires internet connection") + def test_with_document(self, document): # noqa: F811 + # fixture found in test_document + input_media_document = InputMediaDocument(document, caption="test 3") +@@ -502,6 +507,7 @@ def media_group_no_caption_only_parse_mode(photo, thumb): # noqa: F811 + + + class TestSendMediaGroupWithoutRequest: ++ @pytest.mark.skip(reason="Requires internet connection") + async def test_send_media_group_throws_error_with_group_caption_and_individual_captions( + self, + bot, +@@ -601,6 +607,7 @@ class CustomSequence(Sequence): + + + class TestSendMediaGroupWithRequest: ++ __test__ = False + async def test_send_media_group_photo(self, bot, chat_id, media_group): + messages = await bot.send_media_group(chat_id, media_group) + assert isinstance(messages, tuple) +diff --git a/tests/_files/test_photo.py b/tests/_files/test_photo.py +index 9f85bec5..263eb933 100644 +--- a/tests/_files/test_photo.py ++++ b/tests/_files/test_photo.py +@@ -74,6 +74,7 @@ class TestPhotoBase: + + + class TestPhotoWithoutRequest(TestPhotoBase): ++ __test__ = False + def test_slot_behaviour(self, photo): + for attr in photo.__slots__: + assert getattr(photo, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -211,6 +212,7 @@ class TestPhotoWithoutRequest(TestPhotoBase): + + + class TestPhotoWithRequest(TestPhotoBase): ++ __test__ = False + async def test_send_photo_all_args(self, bot, chat_id, photo_file): + message = await bot.send_photo( + chat_id, +diff --git a/tests/_files/test_sticker.py b/tests/_files/test_sticker.py +index c8b9b02a..8c8c9c56 100644 +--- a/tests/_files/test_sticker.py ++++ b/tests/_files/test_sticker.py +@@ -115,6 +115,7 @@ class TestStickerBase: + + + class TestStickerWithoutRequest(TestStickerBase): ++ __test__ = False + def test_slot_behaviour(self, sticker): + for attr in sticker.__slots__: + assert getattr(sticker, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -289,6 +290,7 @@ class TestStickerWithoutRequest(TestStickerBase): + + + class TestStickerWithRequest(TestStickerBase): ++ __test__ = False + async def test_send_all_args(self, bot, chat_id, sticker_file, sticker): + message = await bot.send_sticker( + chat_id, sticker=sticker_file, disable_notification=False, protect_content=True +@@ -526,6 +528,7 @@ class TestStickerSetBase: + + + class TestStickerSetWithoutRequest(TestStickerSetBase): ++ __test__ = False + def test_slot_behaviour(self): + inst = StickerSet("this", "is", True, self.stickers, True, "not") + for attr in inst.__slots__: +diff --git a/tests/_files/test_video.py b/tests/_files/test_video.py +index b2ec1098..d181ffa0 100644 +--- a/tests/_files/test_video.py ++++ b/tests/_files/test_video.py +@@ -65,6 +65,7 @@ class TestVideoBase: + + + class TestVideoWithoutRequest(TestVideoBase): ++ __test__ = False + def test_slot_behaviour(self, video): + for attr in video.__slots__: + assert getattr(video, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -203,6 +204,7 @@ class TestVideoWithoutRequest(TestVideoBase): + + + class TestVideoWithRequest(TestVideoBase): ++ __test__ = False + async def test_send_all_args(self, bot, chat_id, video_file, video, thumb_file): + message = await bot.send_video( + chat_id, +diff --git a/tests/_files/test_videonote.py b/tests/_files/test_videonote.py +index b931678d..223f2541 100644 +--- a/tests/_files/test_videonote.py ++++ b/tests/_files/test_videonote.py +@@ -59,6 +59,7 @@ class TestVideoNoteBase: + + + class TestVideoNoteWithoutRequest(TestVideoNoteBase): ++ __test__ = False + def test_slot_behaviour(self, video_note): + for attr in video_note.__slots__: + assert getattr(video_note, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -190,6 +191,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase): + + + class TestVideoNoteWithRequest(TestVideoNoteBase): ++ __test__ = False + async def test_send_all_args(self, bot, chat_id, video_note_file, video_note, thumb_file): + message = await bot.send_video_note( + chat_id, +diff --git a/tests/_files/test_voice.py b/tests/_files/test_voice.py +index b29260d5..14cdbba7 100644 +--- a/tests/_files/test_voice.py ++++ b/tests/_files/test_voice.py +@@ -58,6 +58,7 @@ class TestVoiceBase: + + + class TestVoiceWithoutRequest(TestVoiceBase): ++ __test__ = False + def test_slot_behaviour(self, voice): + for attr in voice.__slots__: + assert getattr(voice, attr, "err") != "err", f"got extra slot '{attr}'" +@@ -177,6 +178,7 @@ class TestVoiceWithoutRequest(TestVoiceBase): + + + class TestVoiceWithRequest(TestVoiceBase): ++ __test__ = False + async def test_send_all_args(self, bot, chat_id, voice_file, voice): + message = await bot.send_voice( + chat_id, +diff --git a/tests/request/test_request.py b/tests/request/test_request.py +index 9334f7b7..fd3672b9 100644 +--- a/tests/request/test_request.py ++++ b/tests/request/test_request.py +@@ -85,6 +85,7 @@ class TestNoSocksHTTP2WithoutRequest: + + @pytest.mark.skipif(not TEST_WITH_OPT_DEPS, reason="Optional dependencies not installed") + class TestHTTP2WithRequest: ++ __test__ = False + @pytest.mark.parametrize("http_version", ["2", "2.0"]) + async def test_http_2_response(self, http_version): + httpx_request = HTTPXRequest(http_version=http_version) +@@ -352,6 +353,7 @@ class TestRequestWithoutRequest: + + @pytest.mark.skipif(not TEST_WITH_OPT_DEPS, reason="No need to run this twice") + class TestHTTPXRequestWithoutRequest: ++ __test__ = False + test_flag = None + + @pytest.fixture(autouse=True) +@@ -621,6 +623,7 @@ class TestHTTPXRequestWithoutRequest: + + @pytest.mark.skipif(not TEST_WITH_OPT_DEPS, reason="No need to run this twice") + class TestHTTPXRequestWithRequest: ++ __test__ = False + async def test_do_request_wait_for_pool(self, httpx_request): + """The pool logic is buried rather deeply in httpxcore, so we make actual requests here + instead of mocking""" +diff --git a/tests/test_bot.py b/tests/test_bot.py +index d813d9f2..e580c68b 100644 +--- a/tests/test_bot.py ++++ b/tests/test_bot.py +@@ -196,6 +196,7 @@ class InputMessageContentDWPP(InputMessageContent): + + + class TestBotWithoutRequest: ++ __test__ = False + """ + Most are executed on tg.ext.ExtBot, as that class only extends the functionality of tg.bot + +@@ -1791,6 +1792,7 @@ class TestBotWithoutRequest: + + + class TestBotWithRequest: ++ __test__ = False + """ + Most are executed on tg.ext.ExtBot, as that class only extends the functionality of tg.bot + +diff --git a/tests/test_forum.py b/tests/test_forum.py +index d367fc9c..17c5130a 100644 +--- a/tests/test_forum.py ++++ b/tests/test_forum.py +@@ -74,6 +74,7 @@ async def real_topic(bot, emoji_id, forum_group_id): + + + class TestForumTopicWithoutRequest: ++ __test__ = False + def test_slot_behaviour(self, forum_topic_object): + inst = forum_topic_object + for attr in inst.__slots__: +@@ -154,6 +155,7 @@ class TestForumTopicWithoutRequest: + + + class TestForumMethodsWithRequest: ++ __test__ = False + async def test_create_forum_topic(self, real_topic): + result = real_topic + assert isinstance(result, ForumTopic) +@@ -349,7 +351,8 @@ class TestForumTopicCreatedWithoutRequest: + assert isinstance(action_dict, dict) + assert action_dict["name"] == TEST_TOPIC_NAME + assert action_dict["icon_color"] == TEST_TOPIC_ICON_COLOR +- ++ ++ @pytest.mark.skip(reason="Requires internet connection") + def test_equality(self, emoji_id): + a = ForumTopicCreated(name=TEST_TOPIC_NAME, icon_color=TEST_TOPIC_ICON_COLOR) + b = ForumTopicCreated( |
