dev-python/python-telegram-bot: inline test deselection patches

Reduce overall package size and avoid violating ${FILESDIR} size
restrictions. Should also improve maintainability and diffability.

Bump copyright
Fix VariableOrderCheck
Fix whitespace issues
Remove redundant phase functions, function calls and variable
assignments

Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
Lucio Sauer
2024-04-28 19:53:45 +00:00
parent 7a78a93712
commit 7b74a4258f
6 changed files with 324 additions and 1778 deletions

View File

@@ -1,704 +0,0 @@
--- a/tests/_files/test_animation.py
+++ b/tests/_files/test_animation.py
@@ -69,11 +69,13 @@ class TestAnimationBase:
class TestAnimationWithoutRequest(TestAnimationBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, animation):
for attr in animation.__slots__:
assert getattr(animation, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(animation)) == len(set(mro_slots(animation))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, animation):
assert isinstance(animation, Animation)
assert isinstance(animation.file_id, str)
@@ -81,6 +83,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert animation.file_id
assert animation.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, animation):
assert animation.mime_type == self.mime_type
assert animation.file_name.startswith("game.gif") == self.file_name.startswith("game.gif")
@@ -98,6 +101,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert animation.thumb is animation.thumbnail
check_thumb_deprecation_warnings_for_args_and_attrs(recwarn, __file__)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, animation):
json_dict = {
"file_id": self.animation_file_id,
@@ -118,6 +122,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert animation.mime_type == self.mime_type
assert animation.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, animation):
animation_dict = animation.to_dict()
@@ -187,6 +192,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_animation(self, monkeypatch, bot, chat_id, animation):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["animation"] == animation.file_id
@@ -195,6 +201,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert await bot.send_animation(animation=animation, chat_id=chat_id)
@pytest.mark.parametrize("bot_class", ["Bot", "ExtBot"])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_animation_thumb_deprecation_warning(
self, recwarn, monkeypatch, bot_class, bot, raw_bot, chat_id, animation
):
@@ -216,6 +223,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
with pytest.raises(ValueError, match="different entities as 'thumb' and 'thumbnail'"):
await bot.send_animation(chat_id, file, thumbnail=file, thumb=different_file)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, animation):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == animation.file_id
--- a/tests/_files/test_audio.py
+++ b/tests/_files/test_audio.py
@@ -70,11 +70,13 @@ class TestAudioBase:
class TestAudioWithoutRequest(TestAudioBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, audio):
for attr in audio.__slots__:
assert getattr(audio, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(audio)) == len(set(mro_slots(audio))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, audio):
# Make sure file has been uploaded.
assert isinstance(audio, Audio)
@@ -83,6 +85,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio.file_id
assert audio.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, audio):
assert audio.duration == self.duration
assert audio.performer is None
@@ -98,6 +101,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio.thumb is audio.thumbnail
check_thumb_deprecation_warnings_for_args_and_attrs(recwarn, __file__)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, audio):
json_dict = {
"file_id": self.audio_file_id,
@@ -123,6 +127,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert json_audio.file_size == self.file_size
assert json_audio.thumbnail == audio.thumbnail
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, audio):
audio_dict = audio.to_dict()
@@ -134,6 +139,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio_dict["file_size"] == audio.file_size
assert audio_dict["file_name"] == audio.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, audio):
a = Audio(audio.file_id, audio.file_unique_id, audio.duration)
b = Audio("", audio.file_unique_id, audio.duration)
@@ -154,6 +160,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert a != e
assert hash(a) != hash(e)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_audio(self, monkeypatch, bot, chat_id, audio):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["audio"] == audio.file_id
@@ -162,6 +169,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert await bot.send_audio(audio=audio, chat_id=chat_id)
@pytest.mark.parametrize("bot_class", ["Bot", "ExtBot"])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_audio_thumb_deprecation_warning(
self, recwarn, monkeypatch, bot_class, bot, raw_bot, chat_id, audio
):
@@ -214,6 +222,7 @@ class TestAudioWithoutRequest(TestAudioBase):
with pytest.raises(ValueError, match="different entities as 'thumb' and 'thumbnail'"):
await bot.send_audio(chat_id, file, thumbnail=file, thumb=different_file)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, audio):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == audio.file_id
--- a/tests/_files/test_chatphoto.py
+++ b/tests/_files/test_chatphoto.py
@@ -61,11 +61,13 @@ class TestChatPhotoBase:
class TestChatPhotoWithoutRequest(TestChatPhotoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
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}'"
assert len(mro_slots(chat_photo)) == len(set(mro_slots(chat_photo))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, chat_photo):
json_dict = {
"small_file_id": self.chatphoto_small_file_id,
@@ -80,6 +82,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
assert chat_photo.small_file_unique_id == self.chatphoto_small_file_unique_id
assert chat_photo.big_file_unique_id == self.chatphoto_big_file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_to_dict(self, chat_photo):
chat_photo_dict = chat_photo.to_dict()
@@ -121,6 +124,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
assert a != e
assert hash(a) != hash(e)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_chat_photo(self, monkeypatch, bot, super_group_id, chat_photo):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.parameters["photo"] == chat_photo.to_dict()
@@ -129,6 +133,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
message = await bot.set_chat_photo(photo=chat_photo, chat_id=super_group_id)
assert message
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_small_file_instance_method(self, monkeypatch, chat_photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == chat_photo.small_file_id
@@ -142,6 +147,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
monkeypatch.setattr(chat_photo.get_bot(), "get_file", make_assertion)
assert await chat_photo.get_small_file()
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_big_file_instance_method(self, monkeypatch, chat_photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == chat_photo.big_file_id
--- a/tests/_files/test_document.py
+++ b/tests/_files/test_document.py
@@ -65,11 +65,13 @@ class TestDocumentBase:
class TestDocumentWithoutRequest(TestDocumentBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, document):
for attr in document.__slots__:
assert getattr(document, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(document)) == len(set(mro_slots(document))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, document):
assert isinstance(document, Document)
assert isinstance(document.file_id, str)
@@ -77,6 +79,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document.file_id
assert document.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, document):
assert document.file_size == self.file_size
assert document.mime_type == self.mime_type
@@ -90,6 +93,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document.thumb is document.thumbnail
check_thumb_deprecation_warnings_for_args_and_attrs(recwarn, __file__)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, document):
json_dict = {
"file_id": self.document_file_id,
@@ -109,6 +113,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert test_document.mime_type == self.mime_type
assert test_document.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, document):
document_dict = document.to_dict()
@@ -119,6 +124,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document_dict["mime_type"] == document.mime_type
assert document_dict["file_size"] == document.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, document):
a = Document(document.file_id, document.file_unique_id)
b = Document("", document.file_unique_id)
@@ -140,6 +146,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
await bot.send_document(chat_id=chat_id)
@pytest.mark.parametrize("disable_content_type_detection", [True, False, None])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_document(
self, monkeypatch, bot, chat_id, document, disable_content_type_detection
):
@@ -161,6 +168,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert message
@pytest.mark.parametrize("bot_class", ["Bot", "ExtBot"])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_document_thumb_deprecation_warning(
self, recwarn, monkeypatch, bot_class, bot, raw_bot, chat_id, document
):
@@ -208,6 +216,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
with pytest.raises(ValueError, match="different entities as 'thumb' and 'thumbnail'"):
await bot.send_document(chat_id, file, thumbnail=file, thumb=different_file)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, document):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == document.file_id
--- a/tests/_files/test_inputmedia.py
+++ b/tests/_files/test_inputmedia.py
@@ -186,6 +186,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")
@@ -258,6 +259,7 @@ class TestInputMediaPhotoWithoutRequest(TestInputMediaPhotoBase):
]
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")
@@ -329,6 +331,7 @@ class TestInputMediaAnimationWithoutRequest(TestInputMediaAnimationBase):
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")
@@ -411,6 +414,7 @@ class TestInputMediaAudioWithoutRequest(TestInputMediaAudioBase):
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")
@@ -496,6 +500,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")
@@ -559,6 +564,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,
--- a/tests/_files/test_photo.py
+++ b/tests/_files/test_photo.py
@@ -74,11 +74,13 @@ class TestPhotoBase:
class TestPhotoWithoutRequest(TestPhotoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, photo):
for attr in photo.__slots__:
assert getattr(photo, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(photo)) == len(set(mro_slots(photo))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, thumb, photo):
# Make sure file has been uploaded.
assert isinstance(photo, PhotoSize)
@@ -93,6 +95,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert thumb.file_id
assert thumb.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, photo, thumb):
assert photo.width == self.width
assert photo.height == self.height
@@ -101,6 +104,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert thumb.height == 90
assert thumb.file_size == 1477
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, photo):
json_dict = {
"file_id": photo.file_id,
@@ -118,6 +122,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert json_photo.height == self.height
assert json_photo.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, photo):
photo_dict = photo.to_dict()
@@ -128,6 +133,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert photo_dict["height"] == photo.height
assert photo_dict["file_size"] == photo.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, photo):
a = PhotoSize(photo.file_id, photo.file_unique_id, self.width, self.height)
b = PhotoSize("", photo.file_unique_id, self.width, self.height)
@@ -189,6 +195,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_photosize(self, monkeypatch, bot, chat_id, photo):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["photo"] == photo.file_id
@@ -196,6 +203,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
monkeypatch.setattr(bot.request, "post", make_assertion)
assert await bot.send_photo(photo=photo, chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == photo.file_id
--- a/tests/_files/test_sticker.py
+++ b/tests/_files/test_sticker.py
@@ -117,11 +117,13 @@ class TestStickerBase:
class TestStickerWithoutRequest(TestStickerBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, sticker):
for attr in sticker.__slots__:
assert getattr(sticker, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(sticker)) == len(set(mro_slots(sticker))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, sticker):
# Make sure file has been uploaded.
assert isinstance(sticker, Sticker)
@@ -136,6 +138,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert sticker.thumbnail.file_unique_id
assert isinstance(sticker.needs_repainting, bool)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, sticker):
assert sticker.width == self.width
assert sticker.height == self.height
@@ -164,6 +167,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert sticker.thumb is sticker.thumbnail
check_thumb_deprecation_warnings_for_args_and_attrs(recwarn, __file__)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, sticker):
sticker_dict = sticker.to_dict()
@@ -179,6 +183,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert sticker_dict["type"] == sticker.type
assert sticker_dict["needs_repainting"] == sticker.needs_repainting
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, sticker):
json_dict = {
"file_id": self.sticker_file_id,
@@ -212,6 +217,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert json_sticker.custom_emoji_id == self.custom_emoji_id
assert json_sticker.needs_repainting == self.needs_repainting
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, sticker):
a = Sticker(
sticker.file_id,
@@ -274,6 +280,7 @@ class TestStickerWithoutRequest(TestStickerBase):
with pytest.raises(TypeError):
await bot.send_sticker(chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_sticker(self, monkeypatch, bot, chat_id, sticker):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["sticker"] == sticker.file_id
@@ -565,6 +572,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
assert sticker_set.thumb is sticker_set.thumbnail
check_thumb_deprecation_warnings_for_args_and_attrs(recwarn, __file__)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, sticker):
name = f"test_by_{bot.username}"
json_dict = {
@@ -588,6 +596,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
assert sticker_set.sticker_type == self.sticker_type
assert sticker_set.api_kwargs == {"contains_masks": self.contains_masks}
+ @pytest.mark.skip(reason="Requires internet connection")
def test_sticker_set_to_dict(self, sticker_set):
sticker_set_dict = sticker_set.to_dict()
@@ -960,6 +969,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
assert recwarn[0].filename == __file__, "incorrect stacklevel!"
recwarn.clear()
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, sticker):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == sticker.file_id
--- a/tests/_files/test_video.py
+++ b/tests/_files/test_video.py
@@ -69,11 +69,13 @@ class TestVideoBase:
class TestVideoWithoutRequest(TestVideoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, video):
for attr in video.__slots__:
assert getattr(video, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(video)) == len(set(mro_slots(video))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, video):
# Make sure file has been uploaded.
assert isinstance(video, Video)
@@ -88,6 +90,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert video.thumbnail.file_id
assert video.thumbnail.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, video):
assert video.width == self.width
assert video.height == self.height
@@ -130,6 +133,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert json_video.file_size == self.file_size
assert json_video.file_name == self.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, video):
video_dict = video.to_dict()
@@ -143,6 +147,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert video_dict["file_size"] == video.file_size
assert video_dict["file_name"] == video.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, video):
a = Video(video.file_id, video.file_unique_id, self.width, self.height, self.duration)
b = Video("", video.file_unique_id, self.width, self.height, self.duration)
@@ -167,6 +172,7 @@ class TestVideoWithoutRequest(TestVideoBase):
with pytest.raises(TypeError):
await bot.send_video(chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_video(self, monkeypatch, bot, chat_id, video):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["video"] == video.file_id
@@ -175,6 +181,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert await bot.send_video(chat_id, video=video)
@pytest.mark.parametrize("bot_class", ["Bot", "ExtBot"])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_video_thumb_deprecation_warning(
self, recwarn, monkeypatch, bot_class, bot, raw_bot, chat_id, video
):
@@ -228,6 +235,7 @@ class TestVideoWithoutRequest(TestVideoBase):
with pytest.raises(ValueError, match="different entities as 'thumb' and 'thumbnail'"):
await bot.send_video(chat_id, file, thumbnail=file, thumb=different_file)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, video):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == video.file_id
--- a/tests/_files/test_videonote.py
+++ b/tests/_files/test_videonote.py
@@ -63,11 +63,13 @@ class TestVideoNoteBase:
class TestVideoNoteWithoutRequest(TestVideoNoteBase):
+ @pytest.mark.skip(reason="Requires internet connection")
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}'"
assert len(mro_slots(video_note)) == len(set(mro_slots(video_note))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, video_note):
# Make sure file has been uploaded.
assert isinstance(video_note, VideoNote)
@@ -82,6 +84,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert video_note.thumbnail.file_id
assert video_note.thumbnail.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, video_note):
assert video_note.length == self.length
assert video_note.duration == self.duration
@@ -111,6 +114,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert json_video_note.duration == self.duration
assert json_video_note.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, video_note):
video_note_dict = video_note.to_dict()
@@ -121,6 +125,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert video_note_dict["duration"] == video_note.duration
assert video_note_dict["file_size"] == video_note.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, video_note):
a = VideoNote(video_note.file_id, video_note.file_unique_id, self.length, self.duration)
b = VideoNote("", video_note.file_unique_id, self.length, self.duration)
@@ -145,6 +150,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
with pytest.raises(TypeError):
await bot.send_video_note(chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_video_note(self, monkeypatch, bot, chat_id, video_note):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["video_note"] == video_note.file_id
@@ -153,6 +159,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert await bot.send_video_note(chat_id, video_note=video_note)
@pytest.mark.parametrize("bot_class", ["Bot", "ExtBot"])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_video_note_thumb_deprecation_warning(
self, recwarn, monkeypatch, bot_class, bot, raw_bot, chat_id, video_note
):
@@ -210,6 +217,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
with pytest.raises(ValueError, match="different entities as 'thumb' and 'thumbnail'"):
await bot.send_video_note(chat_id, file, thumbnail=file, thumb=different_file)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, video_note):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == video_note.file_id
--- a/tests/_files/test_voice.py
+++ b/tests/_files/test_voice.py
@@ -58,11 +58,13 @@ class TestVoiceBase:
class TestVoiceWithoutRequest(TestVoiceBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, voice):
for attr in voice.__slots__:
assert getattr(voice, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(voice)) == len(set(mro_slots(voice))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_creation(self, voice):
# Make sure file has been uploaded.
assert isinstance(voice, Voice)
@@ -71,6 +73,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert voice.file_id
assert voice.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, voice):
assert voice.duration == self.duration
assert voice.mime_type == self.mime_type
@@ -93,6 +96,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert json_voice.mime_type == self.mime_type
assert json_voice.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, voice):
voice_dict = voice.to_dict()
@@ -103,6 +107,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert voice_dict["mime_type"] == voice.mime_type
assert voice_dict["file_size"] == voice.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, voice):
a = Voice(voice.file_id, voice.file_unique_id, self.duration)
b = Voice("", voice.file_unique_id, self.duration)
@@ -135,6 +140,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert await bot.send_voice(chat_id, voice_file, filename="custom_filename")
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_voice(self, monkeypatch, bot, chat_id, voice):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["voice"] == voice.file_id
@@ -164,6 +170,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, voice):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == voice.file_id
--- a/tests/request/test_request.py
+++ b/tests/request/test_request.py
@@ -418,6 +418,7 @@ class TestHTTPXRequestWithoutRequest:
assert self.test_flag["init"] == 1
assert self.test_flag["shutdown"] == 1
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_multiple_init_cycles(self):
# nothing really to assert - this should just not fail
httpx_request = HTTPXRequest()
@@ -430,6 +431,7 @@ class TestHTTPXRequestWithoutRequest:
with pytest.raises(ValueError, match="`http_version` must be either"):
HTTPXRequest(http_version="1.0")
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_http_1_response(self):
httpx_request = HTTPXRequest(http_version="1.1")
async with httpx_request:
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -305,6 +305,7 @@ class TestBotWithoutRequest:
assert self.test_flag == "stop"
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_equality(self):
async with make_bot(token=FALLBACKS[0]["token"]) as a, make_bot(
token=FALLBACKS[0]["token"]
@@ -346,6 +347,7 @@ class TestBotWithoutRequest:
finally:
await bot.shutdown()
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_me_and_properties(self, bot):
get_me_bot = await ExtBot(bot.token).get_me()
@@ -383,6 +385,7 @@ class TestBotWithoutRequest:
@pytest.mark.parametrize(
("cls", "logger_name"), [(Bot, "telegram.Bot"), (ExtBot, "telegram.ext.ExtBot")]
)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_log_decorator(self, bot: PytestExtBot, cls, logger_name, caplog):
# Second argument makes sure that we ignore logs from e.g. httpx
with caplog.at_level(logging.DEBUG, logger="telegram"):
@@ -1418,6 +1421,7 @@ class TestBotWithoutRequest:
@pytest.mark.parametrize("json_keyboard", [True, False])
@pytest.mark.parametrize("caption", ["<b>Test</b>", "", None])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_copy_message(
self, monkeypatch, bot, chat_id, media_message, json_keyboard, caption
):
--- a/tests/test_forum.py
+++ b/tests/test_forum.py
@@ -73,6 +73,7 @@ async def real_topic(bot, emoji_id, forum_group_id):
assert result is True, "Topic was not deleted"
+@pytest.mark.skip(reason="Requires internet connection")
class TestForumTopicWithoutRequest:
def test_slot_behaviour(self, forum_topic_object):
inst = forum_topic_object
@@ -336,6 +337,7 @@ class TestForumTopicCreatedWithoutRequest:
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(

View File

@@ -1,324 +0,0 @@
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(

View File

@@ -1,718 +0,0 @@
diff --git a/tests/_files/test_animation.py b/tests/_files/test_animation.py
index 23ec3b50..d5b3775d 100644
--- a/tests/_files/test_animation.py
+++ b/tests/_files/test_animation.py
@@ -65,11 +65,13 @@ class TestAnimationBase:
class TestAnimationWithoutRequest(TestAnimationBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, animation):
for attr in animation.__slots__:
assert getattr(animation, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(animation)) == len(set(mro_slots(animation))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, animation):
assert isinstance(animation, Animation)
assert isinstance(animation.file_id, str)
@@ -77,11 +79,13 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert animation.file_id
assert animation.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, animation):
assert animation.mime_type == self.mime_type
assert animation.file_name.startswith("game.gif") == self.file_name.startswith("game.gif")
assert isinstance(animation.thumbnail, PhotoSize)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, animation):
json_dict = {
"file_id": self.animation_file_id,
@@ -102,6 +106,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
assert animation.mime_type == self.mime_type
assert animation.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, animation):
animation_dict = animation.to_dict()
@@ -171,6 +176,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_animation(self, monkeypatch, bot, chat_id, animation):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["animation"] == animation.file_id
@@ -178,6 +184,7 @@ class TestAnimationWithoutRequest(TestAnimationBase):
monkeypatch.setattr(bot.request, "post", make_assertion)
assert await bot.send_animation(animation=animation, chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, animation):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == animation.file_id
diff --git a/tests/_files/test_audio.py b/tests/_files/test_audio.py
index 3ea394d0..17a9388b 100644
--- a/tests/_files/test_audio.py
+++ b/tests/_files/test_audio.py
@@ -66,11 +66,13 @@ class TestAudioBase:
class TestAudioWithoutRequest(TestAudioBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, audio):
for attr in audio.__slots__:
assert getattr(audio, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(audio)) == len(set(mro_slots(audio))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, audio):
# Make sure file has been uploaded.
assert isinstance(audio, Audio)
@@ -79,6 +81,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio.file_id
assert audio.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, audio):
assert audio.duration == self.duration
assert audio.performer is None
@@ -89,6 +92,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio.thumbnail.width == self.thumb_width
assert audio.thumbnail.height == self.thumb_height
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, audio):
json_dict = {
"file_id": self.audio_file_id,
@@ -114,6 +118,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert json_audio.file_size == self.file_size
assert json_audio.thumbnail == audio.thumbnail
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, audio):
audio_dict = audio.to_dict()
@@ -125,6 +130,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert audio_dict["file_size"] == audio.file_size
assert audio_dict["file_name"] == audio.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, audio):
a = Audio(audio.file_id, audio.file_unique_id, audio.duration)
b = Audio("", audio.file_unique_id, audio.duration)
@@ -145,6 +151,7 @@ class TestAudioWithoutRequest(TestAudioBase):
assert a != e
assert hash(a) != hash(e)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_audio(self, monkeypatch, bot, chat_id, audio):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["audio"] == audio.file_id
@@ -183,6 +190,7 @@ class TestAudioWithoutRequest(TestAudioBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, audio):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == audio.file_id
diff --git a/tests/_files/test_chatphoto.py b/tests/_files/test_chatphoto.py
index d09876e2..f115ea9c 100644
--- a/tests/_files/test_chatphoto.py
+++ b/tests/_files/test_chatphoto.py
@@ -61,11 +61,13 @@ class TestChatPhotoBase:
class TestChatPhotoWithoutRequest(TestChatPhotoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
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}'"
assert len(mro_slots(chat_photo)) == len(set(mro_slots(chat_photo))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, chat_photo):
json_dict = {
"small_file_id": self.chatphoto_small_file_id,
@@ -80,6 +82,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
assert chat_photo.small_file_unique_id == self.chatphoto_small_file_unique_id
assert chat_photo.big_file_unique_id == self.chatphoto_big_file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_to_dict(self, chat_photo):
chat_photo_dict = chat_photo.to_dict()
@@ -121,6 +124,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
assert a != e
assert hash(a) != hash(e)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_chat_photo(self, monkeypatch, bot, super_group_id, chat_photo):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.parameters["photo"] == chat_photo.to_dict()
@@ -129,6 +133,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
message = await bot.set_chat_photo(photo=chat_photo, chat_id=super_group_id)
assert message
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_small_file_instance_method(self, monkeypatch, chat_photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == chat_photo.small_file_id
@@ -142,6 +147,7 @@ class TestChatPhotoWithoutRequest(TestChatPhotoBase):
monkeypatch.setattr(chat_photo.get_bot(), "get_file", make_assertion)
assert await chat_photo.get_small_file()
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_big_file_instance_method(self, monkeypatch, chat_photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == chat_photo.big_file_id
diff --git a/tests/_files/test_document.py b/tests/_files/test_document.py
index f5ccdbeb..11d5825e 100644
--- a/tests/_files/test_document.py
+++ b/tests/_files/test_document.py
@@ -61,11 +61,13 @@ class TestDocumentBase:
class TestDocumentWithoutRequest(TestDocumentBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, document):
for attr in document.__slots__:
assert getattr(document, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(document)) == len(set(mro_slots(document))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, document):
assert isinstance(document, Document)
assert isinstance(document.file_id, str)
@@ -73,6 +75,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document.file_id
assert document.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, document):
assert document.file_size == self.file_size
assert document.mime_type == self.mime_type
@@ -81,6 +84,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document.thumbnail.width == self.thumb_width
assert document.thumbnail.height == self.thumb_height
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, document):
json_dict = {
"file_id": self.document_file_id,
@@ -100,6 +104,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert test_document.mime_type == self.mime_type
assert test_document.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, document):
document_dict = document.to_dict()
@@ -110,6 +115,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
assert document_dict["mime_type"] == document.mime_type
assert document_dict["file_size"] == document.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, document):
a = Document(document.file_id, document.file_unique_id)
b = Document("", document.file_unique_id)
@@ -131,6 +137,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
await bot.send_document(chat_id=chat_id)
@pytest.mark.parametrize("disable_content_type_detection", [True, False, None])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_document(
self, monkeypatch, bot, chat_id, document, disable_content_type_detection
):
@@ -177,6 +184,7 @@ class TestDocumentWithoutRequest(TestDocumentBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, document):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == document.file_id
diff --git a/tests/_files/test_inputmedia.py b/tests/_files/test_inputmedia.py
index f00dd165..1f99d302 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")
@@ -243,6 +244,7 @@ class TestInputMediaPhotoWithoutRequest(TestInputMediaPhotoBase):
]
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")
@@ -308,6 +310,7 @@ class TestInputMediaAnimationWithoutRequest(TestInputMediaAnimationBase):
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")
@@ -376,6 +379,7 @@ class TestInputMediaAudioWithoutRequest(TestInputMediaAudioBase):
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,
diff --git a/tests/_files/test_photo.py b/tests/_files/test_photo.py
index 9f85bec5..cd47e48f 100644
--- a/tests/_files/test_photo.py
+++ b/tests/_files/test_photo.py
@@ -74,11 +74,13 @@ class TestPhotoBase:
class TestPhotoWithoutRequest(TestPhotoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, photo):
for attr in photo.__slots__:
assert getattr(photo, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(photo)) == len(set(mro_slots(photo))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, thumb, photo):
# Make sure file has been uploaded.
assert isinstance(photo, PhotoSize)
@@ -93,6 +95,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert thumb.file_id
assert thumb.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, photo, thumb):
assert photo.width == self.width
assert photo.height == self.height
@@ -103,6 +106,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
# so far
assert thumb.file_size in [1475, 1477]
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, photo):
json_dict = {
"file_id": photo.file_id,
@@ -120,6 +124,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert json_photo.height == self.height
assert json_photo.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, photo):
photo_dict = photo.to_dict()
@@ -130,6 +135,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
assert photo_dict["height"] == photo.height
assert photo_dict["file_size"] == photo.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, photo):
a = PhotoSize(photo.file_id, photo.file_unique_id, self.width, self.height)
b = PhotoSize("", photo.file_unique_id, self.width, self.height)
@@ -191,6 +197,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_photosize(self, monkeypatch, bot, chat_id, photo):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["photo"] == photo.file_id
@@ -198,6 +205,7 @@ class TestPhotoWithoutRequest(TestPhotoBase):
monkeypatch.setattr(bot.request, "post", make_assertion)
assert await bot.send_photo(photo=photo, chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, photo):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == photo.file_id
diff --git a/tests/_files/test_sticker.py b/tests/_files/test_sticker.py
index c8b9b02a..8d5ff664 100644
--- a/tests/_files/test_sticker.py
+++ b/tests/_files/test_sticker.py
@@ -115,11 +115,13 @@ class TestStickerBase:
class TestStickerWithoutRequest(TestStickerBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, sticker):
for attr in sticker.__slots__:
assert getattr(sticker, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(sticker)) == len(set(mro_slots(sticker))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, sticker):
# Make sure file has been uploaded.
assert isinstance(sticker, Sticker)
@@ -134,6 +136,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert sticker.thumbnail.file_unique_id
assert isinstance(sticker.needs_repainting, bool)
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, sticker):
assert sticker.width == self.width
assert sticker.height == self.height
@@ -148,6 +151,7 @@ class TestStickerWithoutRequest(TestStickerBase):
# we need to be a premium TG user to send a premium sticker, so the below is not tested
# assert sticker.premium_animation == self.premium_animation
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, sticker):
sticker_dict = sticker.to_dict()
@@ -163,6 +167,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert sticker_dict["type"] == sticker.type
assert sticker_dict["needs_repainting"] == sticker.needs_repainting
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, sticker):
json_dict = {
"file_id": self.sticker_file_id,
@@ -196,6 +201,7 @@ class TestStickerWithoutRequest(TestStickerBase):
assert json_sticker.custom_emoji_id == self.custom_emoji_id
assert json_sticker.needs_repainting == self.needs_repainting
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, sticker):
a = Sticker(
sticker.file_id,
@@ -258,6 +264,7 @@ class TestStickerWithoutRequest(TestStickerBase):
with pytest.raises(TypeError):
await bot.send_sticker(chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_sticker(self, monkeypatch, bot, chat_id, sticker):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["sticker"] == sticker.file_id
@@ -532,6 +539,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
assert getattr(inst, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(inst)) == len(set(mro_slots(inst))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, sticker):
name = f"test_by_{bot.username}"
json_dict = {
@@ -555,6 +563,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
assert sticker_set.sticker_type == self.sticker_type
assert sticker_set.api_kwargs == {"contains_masks": self.contains_masks}
+ @pytest.mark.skip(reason="Requires internet connection")
def test_sticker_set_to_dict(self, sticker_set):
sticker_set_dict = sticker_set.to_dict()
@@ -726,6 +735,7 @@ class TestStickerSetWithoutRequest(TestStickerSetBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, sticker):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == sticker.file_id
diff --git a/tests/_files/test_video.py b/tests/_files/test_video.py
index b2ec1098..f6d4280f 100644
--- a/tests/_files/test_video.py
+++ b/tests/_files/test_video.py
@@ -65,11 +65,13 @@ class TestVideoBase:
class TestVideoWithoutRequest(TestVideoBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, video):
for attr in video.__slots__:
assert getattr(video, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(video)) == len(set(mro_slots(video))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, video):
# Make sure file has been uploaded.
assert isinstance(video, Video)
@@ -84,6 +86,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert video.thumbnail.file_id
assert video.thumbnail.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, video):
assert video.width == self.width
assert video.height == self.height
@@ -114,6 +117,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert json_video.file_size == self.file_size
assert json_video.file_name == self.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, video):
video_dict = video.to_dict()
@@ -127,6 +131,7 @@ class TestVideoWithoutRequest(TestVideoBase):
assert video_dict["file_size"] == video.file_size
assert video_dict["file_name"] == video.file_name
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, video):
a = Video(video.file_id, video.file_unique_id, self.width, self.height, self.duration)
b = Video("", video.file_unique_id, self.width, self.height, self.duration)
@@ -151,6 +156,7 @@ class TestVideoWithoutRequest(TestVideoBase):
with pytest.raises(TypeError):
await bot.send_video(chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_video(self, monkeypatch, bot, chat_id, video):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["video"] == video.file_id
@@ -190,6 +196,7 @@ class TestVideoWithoutRequest(TestVideoBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, video):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == video.file_id
diff --git a/tests/_files/test_videonote.py b/tests/_files/test_videonote.py
index b931678d..717d86fb 100644
--- a/tests/_files/test_videonote.py
+++ b/tests/_files/test_videonote.py
@@ -59,11 +59,13 @@ class TestVideoNoteBase:
class TestVideoNoteWithoutRequest(TestVideoNoteBase):
+ @pytest.mark.skip(reason="Requires internet connection")
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}'"
assert len(mro_slots(video_note)) == len(set(mro_slots(video_note))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
def test_creation(self, video_note):
# Make sure file has been uploaded.
assert isinstance(video_note, VideoNote)
@@ -78,6 +80,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert video_note.thumbnail.file_id
assert video_note.thumbnail.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, video_note):
assert video_note.length == self.length
assert video_note.duration == self.duration
@@ -100,6 +103,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert json_video_note.duration == self.duration
assert json_video_note.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, video_note):
video_note_dict = video_note.to_dict()
@@ -110,6 +114,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
assert video_note_dict["duration"] == video_note.duration
assert video_note_dict["file_size"] == video_note.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, video_note):
a = VideoNote(video_note.file_id, video_note.file_unique_id, self.length, self.duration)
b = VideoNote("", video_note.file_unique_id, self.length, self.duration)
@@ -134,6 +139,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
with pytest.raises(TypeError):
await bot.send_video_note(chat_id=chat_id)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_video_note(self, monkeypatch, bot, chat_id, video_note):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["video_note"] == video_note.file_id
@@ -177,6 +183,7 @@ class TestVideoNoteWithoutRequest(TestVideoNoteBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, video_note):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == video_note.file_id
diff --git a/tests/_files/test_voice.py b/tests/_files/test_voice.py
index b29260d5..77d9f719 100644
--- a/tests/_files/test_voice.py
+++ b/tests/_files/test_voice.py
@@ -58,11 +58,13 @@ class TestVoiceBase:
class TestVoiceWithoutRequest(TestVoiceBase):
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, voice):
for attr in voice.__slots__:
assert getattr(voice, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(voice)) == len(set(mro_slots(voice))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_creation(self, voice):
# Make sure file has been uploaded.
assert isinstance(voice, Voice)
@@ -71,6 +73,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert voice.file_id
assert voice.file_unique_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_expected_values(self, voice):
assert voice.duration == self.duration
assert voice.mime_type == self.mime_type
@@ -93,6 +96,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert json_voice.mime_type == self.mime_type
assert json_voice.file_size == self.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, voice):
voice_dict = voice.to_dict()
@@ -103,6 +107,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert voice_dict["mime_type"] == voice.mime_type
assert voice_dict["file_size"] == voice.file_size
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, voice):
a = Voice(voice.file_id, voice.file_unique_id, self.duration)
b = Voice("", voice.file_unique_id, self.duration)
@@ -135,6 +140,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
assert await bot.send_voice(chat_id, voice_file, filename="custom_filename")
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_send_with_voice(self, monkeypatch, bot, chat_id, voice):
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
return request_data.json_parameters["voice"] == voice.file_id
@@ -164,6 +170,7 @@ class TestVoiceWithoutRequest(TestVoiceBase):
finally:
bot._local_mode = False
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_file_instance_method(self, monkeypatch, voice):
async def make_assertion(*_, **kwargs):
return kwargs["file_id"] == voice.file_id
diff --git a/tests/request/test_request.py b/tests/request/test_request.py
index 9334f7b7..80aef409 100644
--- a/tests/request/test_request.py
+++ b/tests/request/test_request.py
@@ -422,6 +422,7 @@ class TestHTTPXRequestWithoutRequest:
assert self.test_flag["init"] == 1
assert self.test_flag["shutdown"] == 1
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_multiple_init_cycles(self):
# nothing really to assert - this should just not fail
httpx_request = HTTPXRequest()
@@ -434,6 +435,7 @@ class TestHTTPXRequestWithoutRequest:
with pytest.raises(ValueError, match="`http_version` must be either"):
HTTPXRequest(http_version="1.0")
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_http_1_response(self):
httpx_request = HTTPXRequest(http_version="1.1")
async with httpx_request:
diff --git a/tests/test_bot.py b/tests/test_bot.py
index ba3c82af..86970d73 100644
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -311,6 +311,7 @@ class TestBotWithoutRequest:
assert self.test_flag == "stop"
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_equality(self):
async with make_bot(token=FALLBACKS[0]["token"]) as a, make_bot(
token=FALLBACKS[0]["token"]
@@ -352,6 +353,7 @@ class TestBotWithoutRequest:
finally:
await bot.shutdown()
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_get_me_and_properties(self, bot):
get_me_bot = await ExtBot(bot.token).get_me()
@@ -389,6 +391,7 @@ class TestBotWithoutRequest:
@pytest.mark.parametrize(
("cls", "logger_name"), [(Bot, "telegram.Bot"), (ExtBot, "telegram.ext.ExtBot")]
)
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_log_decorator(self, bot: PytestExtBot, cls, logger_name, caplog):
# Second argument makes sure that we ignore logs from e.g. httpx
with caplog.at_level(logging.DEBUG, logger="telegram"):
@@ -1395,6 +1398,7 @@ class TestBotWithoutRequest:
@pytest.mark.parametrize("json_keyboard", [True, False])
@pytest.mark.parametrize("caption", ["<b>Test</b>", "", None])
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_copy_message(
self, monkeypatch, bot, chat_id, media_message, json_keyboard, caption
):
diff --git a/tests/test_forum.py b/tests/test_forum.py
index d367fc9c..a130a5cc 100644
--- a/tests/test_forum.py
+++ b/tests/test_forum.py
@@ -74,18 +74,21 @@ async def real_topic(bot, emoji_id, forum_group_id):
class TestForumTopicWithoutRequest:
+ @pytest.mark.skip(reason="Requires internet connection")
def test_slot_behaviour(self, forum_topic_object):
inst = forum_topic_object
for attr in inst.__slots__:
assert getattr(inst, attr, "err") != "err", f"got extra slot '{attr}'"
assert len(mro_slots(inst)) == len(set(mro_slots(inst))), "duplicate slot"
+ @pytest.mark.skip(reason="Requires internet connection")
async def test_expected_values(self, emoji_id, forum_group_id, forum_topic_object):
assert forum_topic_object.message_thread_id == forum_group_id
assert forum_topic_object.icon_color == TEST_TOPIC_ICON_COLOR
assert forum_topic_object.name == TEST_TOPIC_NAME
assert forum_topic_object.icon_custom_emoji_id == emoji_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_de_json(self, bot, emoji_id, forum_group_id):
assert ForumTopic.de_json(None, bot=bot) is None
@@ -103,6 +106,7 @@ class TestForumTopicWithoutRequest:
assert topic.name == TEST_TOPIC_NAME
assert topic.icon_custom_emoji_id == emoji_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_to_dict(self, emoji_id, forum_group_id, forum_topic_object):
topic_dict = forum_topic_object.to_dict()
@@ -112,6 +116,7 @@ class TestForumTopicWithoutRequest:
assert topic_dict["icon_color"] == TEST_TOPIC_ICON_COLOR
assert topic_dict["icon_custom_emoji_id"] == emoji_id
+ @pytest.mark.skip(reason="Requires internet connection")
def test_equality(self, emoji_id, forum_group_id):
a = ForumTopic(
message_thread_id=forum_group_id,
@@ -350,6 +355,7 @@ class TestForumTopicCreatedWithoutRequest:
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(

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Gentoo Authors
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -33,24 +33,124 @@ BDEPEND="
)
"
PATCHES=(
"${FILESDIR}/${P}-no-internet-tests.patch"
# These tests require an internet connection
EPYTEST_DESELECT=(
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_creation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_de_json
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_expected_values
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_get_file_instance_method
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_send_animation_thumb_deprecation_warning
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_send_with_animation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_slot_behaviour
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_to_dict
tests/_files/test_audio.py::TestAudioWithoutRequest::test_creation
tests/_files/test_audio.py::TestAudioWithoutRequest::test_de_json
tests/_files/test_audio.py::TestAudioWithoutRequest::test_equality
tests/_files/test_audio.py::TestAudioWithoutRequest::test_expected_values
tests/_files/test_audio.py::TestAudioWithoutRequest::test_get_file_instance_method
tests/_files/test_audio.py::TestAudioWithoutRequest::test_send_audio_thumb_deprecation_warning
tests/_files/test_audio.py::TestAudioWithoutRequest::test_send_with_audio
tests/_files/test_audio.py::TestAudioWithoutRequest::test_slot_behaviour
tests/_files/test_audio.py::TestAudioWithoutRequest::test_to_dict
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_de_json
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_big_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_small_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_send_with_chat_photo
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_to_dict
tests/_files/test_document.py::TestDocumentWithoutRequest::test_creation
tests/_files/test_document.py::TestDocumentWithoutRequest::test_de_json
tests/_files/test_document.py::TestDocumentWithoutRequest::test_equality
tests/_files/test_document.py::TestDocumentWithoutRequest::test_expected_values
tests/_files/test_document.py::TestDocumentWithoutRequest::test_get_file_instance_method
tests/_files/test_document.py::TestDocumentWithoutRequest::test_send_document_thumb_deprecation_warning
tests/_files/test_document.py::TestDocumentWithoutRequest::test_send_with_document
tests/_files/test_document.py::TestDocumentWithoutRequest::test_slot_behaviour
tests/_files/test_document.py::TestDocumentWithoutRequest::test_to_dict
tests/_files/test_inputmedia.py::TestInputMediaAnimationWithoutRequest::test_with_animation
tests/_files/test_inputmedia.py::TestInputMediaAudioWithoutRequest::test_with_audio
tests/_files/test_inputmedia.py::TestInputMediaDocumentWithoutRequest::test_with_document
tests/_files/test_inputmedia.py::TestInputMediaPhotoWithoutRequest::test_with_photo
tests/_files/test_inputmedia.py::TestInputMediaVideoWithoutRequest::test_with_video
tests/_files/test_inputmedia.py::TestSendMediaGroupWithoutRequest::test_send_media_group_throws_error_with_group_caption_and_individual_captions
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_creation
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_de_json
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_equality
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_expected_values
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_get_file_instance_method
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_send_with_photosize
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_to_dict
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_get_file_instance_method
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_sticker_set_to_dict
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_creation
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_equality
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_expected_values
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_send_with_sticker
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_slot_behaviour
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_to_dict
tests/_files/test_video.py::TestVideoWithoutRequest::test_creation
tests/_files/test_video.py::TestVideoWithoutRequest::test_equality
tests/_files/test_video.py::TestVideoWithoutRequest::test_expected_values
tests/_files/test_video.py::TestVideoWithoutRequest::test_get_file_instance_method
tests/_files/test_video.py::TestVideoWithoutRequest::test_send_video_thumb_deprecation_warning
tests/_files/test_video.py::TestVideoWithoutRequest::test_send_with_video
tests/_files/test_video.py::TestVideoWithoutRequest::test_slot_behaviour
tests/_files/test_video.py::TestVideoWithoutRequest::test_to_dict
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_creation
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_equality
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_expected_values
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_get_file_instance_method
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_send_video_note_thumb_deprecation_warning
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_send_with_video_note
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_slot_behaviour
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_to_dict
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_creation
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_equality
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_expected_values
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_get_file_instance_method
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_send_with_voice
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_slot_behaviour
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_to_dict
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_after_shutdown
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_exceptions
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_manual_timeouts
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_no_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_with_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_return_value
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_http_1_response
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_multiple_init_cycles
tests/request/test_request.py::TestRequestWithoutRequest::test_chat_migrated
tests/request/test_request.py::TestRequestWithoutRequest::test_error_description
tests/request/test_request.py::TestRequestWithoutRequest::test_exceptions_in_do_request
tests/request/test_request.py::TestRequestWithoutRequest::test_illegal_json_response
tests/request/test_request.py::TestRequestWithoutRequest::test_replaced_unprintable_char
tests/request/test_request.py::TestRequestWithoutRequest::test_retrieve
tests/request/test_request.py::TestRequestWithoutRequest::test_retry_after
tests/request/test_request.py::TestRequestWithoutRequest::test_special_errors
tests/request/test_request.py::TestRequestWithoutRequest::test_timeout_propagation
tests/request/test_request.py::TestRequestWithoutRequest::test_unknown_request_params
tests/test_bot.py::TestBotWithoutRequest::test_copy_message
tests/test_bot.py::TestBotWithoutRequest::test_equality
tests/test_bot.py::TestBotWithoutRequest::test_get_me_and_properties
tests/test_bot.py::TestBotWithoutRequest::test_log_decorator
tests/test_forum.py::TestForumTopicCreatedWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_de_json
tests/test_forum.py::TestForumTopicWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_expected_values
tests/test_forum.py::TestForumTopicWithoutRequest::test_slot_behaviour
tests/test_forum.py::TestForumTopicWithoutRequest::test_to_dict
)
S="${WORKDIR}/${PN}-${PV}"
distutils_enable_tests pytest
# Run only the tests that don't require a connection
python_test() {
epytest -m no_req
}
python_prepare_all() {
distutils-r1_python_prepare_all
epytest -m no_req
}
pkg_postinst() {
optfeature_header "Optional package dependencies:"
optfeature "using telegram.ext.JobQueue" dev-python/APScheduler
optfeature "using telegram.ext.JobQueue" dev-python/APScheduler
}

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Gentoo Authors
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -33,8 +33,110 @@ BDEPEND="
)
"
PATCHES=(
"${FILESDIR}/${P}-no-internet-tests.patch"
# These tests require an internet connection
EPYTEST_DESELECT=(
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_creation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_de_json
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_expected_values
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_get_file_instance_method
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_send_with_animation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_slot_behaviour
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_to_dict
tests/_files/test_audio.py::TestAudioWithoutRequest::test_creation
tests/_files/test_audio.py::TestAudioWithoutRequest::test_de_json
tests/_files/test_audio.py::TestAudioWithoutRequest::test_equality
tests/_files/test_audio.py::TestAudioWithoutRequest::test_expected_values
tests/_files/test_audio.py::TestAudioWithoutRequest::test_get_file_instance_method
tests/_files/test_audio.py::TestAudioWithoutRequest::test_send_with_audio
tests/_files/test_audio.py::TestAudioWithoutRequest::test_slot_behaviour
tests/_files/test_audio.py::TestAudioWithoutRequest::test_to_dict
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_de_json
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_big_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_small_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_send_with_chat_photo
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_to_dict
tests/_files/test_document.py::TestDocumentWithoutRequest::test_creation
tests/_files/test_document.py::TestDocumentWithoutRequest::test_de_json
tests/_files/test_document.py::TestDocumentWithoutRequest::test_equality
tests/_files/test_document.py::TestDocumentWithoutRequest::test_expected_values
tests/_files/test_document.py::TestDocumentWithoutRequest::test_get_file_instance_method
tests/_files/test_document.py::TestDocumentWithoutRequest::test_send_with_document
tests/_files/test_document.py::TestDocumentWithoutRequest::test_slot_behaviour
tests/_files/test_document.py::TestDocumentWithoutRequest::test_to_dict
tests/_files/test_inputmedia.py::TestInputMediaAnimationWithoutRequest::test_with_animation
tests/_files/test_inputmedia.py::TestInputMediaAudioWithoutRequest::test_with_audio
tests/_files/test_inputmedia.py::TestInputMediaDocumentWithoutRequest::test_with_document
tests/_files/test_inputmedia.py::TestInputMediaPhotoWithoutRequest::test_with_photo
tests/_files/test_inputmedia.py::TestInputMediaVideoWithoutRequest::test_with_video
tests/_files/test_inputmedia.py::TestSendMediaGroupWithoutRequest::test_send_media_group_throws_error_with_group_caption_and_individual_captions
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_creation
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_de_json
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_equality
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_expected_values
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_get_file_instance_method
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_send_with_photosize
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_to_dict
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_get_file_instance_method
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_sticker_set_to_dict
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_creation
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_equality
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_expected_values
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_send_with_sticker
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_slot_behaviour
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_to_dict
tests/_files/test_video.py::TestVideoWithoutRequest::test_creation
tests/_files/test_video.py::TestVideoWithoutRequest::test_equality
tests/_files/test_video.py::TestVideoWithoutRequest::test_expected_values
tests/_files/test_video.py::TestVideoWithoutRequest::test_get_file_instance_method
tests/_files/test_video.py::TestVideoWithoutRequest::test_send_with_video
tests/_files/test_video.py::TestVideoWithoutRequest::test_slot_behaviour
tests/_files/test_video.py::TestVideoWithoutRequest::test_to_dict
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_creation
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_equality
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_expected_values
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_get_file_instance_method
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_send_with_video_note
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_slot_behaviour
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_to_dict
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_creation
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_equality
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_expected_values
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_get_file_instance_method
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_send_with_voice
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_slot_behaviour
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_to_dict
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_after_shutdown
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_exceptions
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_manual_timeouts
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_no_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_with_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_return_value
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_http_1_response
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_multiple_init_cycles
tests/request/test_request.py::TestRequestWithoutRequest::test_chat_migrated
tests/request/test_request.py::TestRequestWithoutRequest::test_error_description
tests/request/test_request.py::TestRequestWithoutRequest::test_exceptions_in_do_request
tests/request/test_request.py::TestRequestWithoutRequest::test_illegal_json_response
tests/request/test_request.py::TestRequestWithoutRequest::test_replaced_unprintable_char
tests/request/test_request.py::TestRequestWithoutRequest::test_retrieve
tests/request/test_request.py::TestRequestWithoutRequest::test_retry_after
tests/request/test_request.py::TestRequestWithoutRequest::test_special_errors
tests/request/test_request.py::TestRequestWithoutRequest::test_timeout_propagation
tests/request/test_request.py::TestRequestWithoutRequest::test_unknown_request_params
tests/test_bot.py::TestBotWithoutRequest::test_copy_message
tests/test_bot.py::TestBotWithoutRequest::test_equality
tests/test_bot.py::TestBotWithoutRequest::test_get_me_and_properties
tests/test_bot.py::TestBotWithoutRequest::test_log_decorator
tests/test_forum.py::TestForumTopicCreatedWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_de_json
tests/test_forum.py::TestForumTopicWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_expected_values
tests/test_forum.py::TestForumTopicWithoutRequest::test_slot_behaviour
tests/test_forum.py::TestForumTopicWithoutRequest::test_to_dict
)
distutils_enable_tests pytest
@@ -44,11 +146,6 @@ python_test() {
epytest -m no_req
}
python_prepare_all() {
distutils-r1_python_prepare_all
}
pkg_postinst() {
optfeature_header "Optional package dependencies:"
optfeature "using telegram.ext.JobQueue" dev-python/APScheduler
optfeature "using telegram.ext.JobQueue" dev-python/APScheduler
}

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Gentoo Authors
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -33,24 +33,119 @@ BDEPEND="
)
"
PATCHES=(
"${FILESDIR}/${P}-no-internet-tests.patch"
# These tests require an internet connection
EPYTEST_DESELECT=(
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_creation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_de_json
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_expected_values
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_get_file_instance_method
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_send_with_animation
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_slot_behaviour
tests/_files/test_animation.py::TestAnimationWithoutRequest::test_to_dict
tests/_files/test_audio.py::TestAudioWithoutRequest::test_creation
tests/_files/test_audio.py::TestAudioWithoutRequest::test_de_json
tests/_files/test_audio.py::TestAudioWithoutRequest::test_equality
tests/_files/test_audio.py::TestAudioWithoutRequest::test_expected_values
tests/_files/test_audio.py::TestAudioWithoutRequest::test_get_file_instance_method
tests/_files/test_audio.py::TestAudioWithoutRequest::test_send_with_audio
tests/_files/test_audio.py::TestAudioWithoutRequest::test_slot_behaviour
tests/_files/test_audio.py::TestAudioWithoutRequest::test_to_dict
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_de_json
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_big_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_get_small_file_instance_method
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_send_with_chat_photo
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_chatphoto.py::TestChatPhotoWithoutRequest::test_to_dict
tests/_files/test_document.py::TestDocumentWithoutRequest::test_creation
tests/_files/test_document.py::TestDocumentWithoutRequest::test_de_json
tests/_files/test_document.py::TestDocumentWithoutRequest::test_equality
tests/_files/test_document.py::TestDocumentWithoutRequest::test_expected_values
tests/_files/test_document.py::TestDocumentWithoutRequest::test_get_file_instance_method
tests/_files/test_document.py::TestDocumentWithoutRequest::test_send_with_document
tests/_files/test_document.py::TestDocumentWithoutRequest::test_slot_behaviour
tests/_files/test_document.py::TestDocumentWithoutRequest::test_to_dict
tests/_files/test_inputmedia.py::TestInputMediaAnimationWithoutRequest::test_with_animation
tests/_files/test_inputmedia.py::TestInputMediaAudioWithoutRequest::test_with_audio
tests/_files/test_inputmedia.py::TestInputMediaDocumentWithoutRequest::test_with_document
tests/_files/test_inputmedia.py::TestInputMediaPhotoWithoutRequest::test_with_photo
tests/_files/test_inputmedia.py::TestInputMediaVideoWithoutRequest::test_with_video
tests/_files/test_inputmedia.py::TestSendMediaGroupWithoutRequest::test_send_media_group_throws_error_with_group_caption_and_individual_captions
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_creation
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_de_json
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_equality
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_expected_values
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_get_file_instance_method
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_send_with_photosize
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_slot_behaviour
tests/_files/test_photo.py::TestPhotoWithoutRequest::test_to_dict
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_get_file_instance_method
tests/_files/test_sticker.py::TestStickerSetWithoutRequest::test_sticker_set_to_dict
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_creation
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_de_json
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_equality
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_expected_values
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_send_with_sticker
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_slot_behaviour
tests/_files/test_sticker.py::TestStickerWithoutRequest::test_to_dict
tests/_files/test_video.py::TestVideoWithoutRequest::test_creation
tests/_files/test_video.py::TestVideoWithoutRequest::test_equality
tests/_files/test_video.py::TestVideoWithoutRequest::test_expected_values
tests/_files/test_video.py::TestVideoWithoutRequest::test_get_file_instance_method
tests/_files/test_video.py::TestVideoWithoutRequest::test_send_with_video
tests/_files/test_video.py::TestVideoWithoutRequest::test_slot_behaviour
tests/_files/test_video.py::TestVideoWithoutRequest::test_to_dict
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_creation
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_equality
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_expected_values
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_get_file_instance_method
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_send_with_video_note
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_slot_behaviour
tests/_files/test_videonote.py::TestVideoNoteWithoutRequest::test_to_dict
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_creation
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_equality
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_expected_values
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_get_file_instance_method
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_send_with_voice
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_slot_behaviour
tests/_files/test_voice.py::TestVoiceWithoutRequest::test_to_dict
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_after_shutdown
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_exceptions
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_manual_timeouts
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_no_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_params_with_data
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_do_request_return_value
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_http_1_response
tests/request/test_request.py::TestHTTPXRequestWithoutRequest::test_multiple_init_cycles
tests/request/test_request.py::TestRequestWithoutRequest::test_chat_migrated
tests/request/test_request.py::TestRequestWithoutRequest::test_error_description
tests/request/test_request.py::TestRequestWithoutRequest::test_exceptions_in_do_request
tests/request/test_request.py::TestRequestWithoutRequest::test_illegal_json_response
tests/request/test_request.py::TestRequestWithoutRequest::test_replaced_unprintable_char
tests/request/test_request.py::TestRequestWithoutRequest::test_retrieve
tests/request/test_request.py::TestRequestWithoutRequest::test_retry_after
tests/request/test_request.py::TestRequestWithoutRequest::test_special_errors
tests/request/test_request.py::TestRequestWithoutRequest::test_timeout_propagation
tests/request/test_request.py::TestRequestWithoutRequest::test_unknown_request_params
tests/test_bot.py::TestBotWithoutRequest::test_copy_message
tests/test_bot.py::TestBotWithoutRequest::test_equality
tests/test_bot.py::TestBotWithoutRequest::test_get_me_and_properties
tests/test_bot.py::TestBotWithoutRequest::test_log_decorator
tests/test_forum.py::TestForumTopicCreatedWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_de_json
tests/test_forum.py::TestForumTopicWithoutRequest::test_equality
tests/test_forum.py::TestForumTopicWithoutRequest::test_expected_values
tests/test_forum.py::TestForumTopicWithoutRequest::test_slot_behaviour
tests/test_forum.py::TestForumTopicWithoutRequest::test_to_dict
)
S="${WORKDIR}/${PN}-${PV}"
distutils_enable_tests pytest
# Run only the tests that don't require a connection
python_test() {
epytest -m no_req
}
python_prepare_all() {
distutils-r1_python_prepare_all
epytest -m no_req
}
pkg_postinst() {
optfeature_header "Optional package dependencies:"
optfeature "using telegram.ext.JobQueue" dev-python/APScheduler
}