mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
unitests: use home brewed timeout for tests
This commit is contained in:
parent
d05fa1275a
commit
ec13a36bdd
8 changed files with 99 additions and 71 deletions
|
@ -21,6 +21,11 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
import traceback
|
||||
|
||||
from nose.tools import make_decorator, TimeExpired
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import json
|
||||
|
@ -54,3 +59,33 @@ class BaseTest(object):
|
|||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class TestTimedOut(AssertionError):
|
||||
|
||||
def __init__(self, time_limit, frame):
|
||||
super(TestTimedOut, self).__init__('time_limit={0}\n{1}'.format(
|
||||
time_limit, ''.join(traceback.format_stack(frame))))
|
||||
self.time_limit = time_limit
|
||||
self.frame = frame
|
||||
|
||||
|
||||
def timeout(time_limit):
|
||||
def decorator(func):
|
||||
def timed_out(_signum, frame):
|
||||
raise TestTimedOut(time_limit, frame)
|
||||
|
||||
def newfunc(*args, **kwargs):
|
||||
orig_handler = signal.signal(signal.SIGALRM, timed_out)
|
||||
signal.alarm(time_limit)
|
||||
try:
|
||||
rc = func(*args, **kwargs)
|
||||
finally:
|
||||
signal.alarm(0)
|
||||
signal.signal(signal.SIGALRM, orig_handler)
|
||||
return rc
|
||||
|
||||
newfunc = make_decorator(func)(newfunc)
|
||||
return newfunc
|
||||
|
||||
return decorator
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class AudioTest(BaseTest, unittest.TestCase):
|
||||
|
@ -54,7 +53,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_required_args_only(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - With required arguments only')
|
||||
|
@ -73,7 +72,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - With all arguments')
|
||||
|
@ -97,7 +96,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_mp3_file(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File')
|
||||
|
@ -119,7 +118,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_mp3_file_custom_filename(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File with custom filename')
|
||||
|
@ -142,7 +141,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_mp3_url_file(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File by URL')
|
||||
|
@ -164,7 +163,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_audio_resend(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - Resend by file_id')
|
||||
|
@ -219,7 +218,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_audio_empty_file(self):
|
||||
print('Testing bot.sendAudio - Null file')
|
||||
|
||||
|
@ -233,7 +232,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_audio_empty_file_id(self):
|
||||
print('Testing bot.sendAudio - Empty file_id')
|
||||
|
||||
|
@ -247,7 +246,7 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_audio_without_required_args(self):
|
||||
print('Testing bot.sendAudio - Without required arguments')
|
||||
|
||||
|
|
|
@ -33,15 +33,14 @@ else:
|
|||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from nose.tools import timed
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class BotTest(BaseTest, unittest.TestCase):
|
||||
"""This object represents Tests for Telegram Bot."""
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testGetMe(self):
|
||||
'''Test the telegram.Bot getMe method'''
|
||||
print('Testing getMe')
|
||||
|
@ -55,7 +54,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(bot.name, '@PythonTelegramBot')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendMessage(self):
|
||||
'''Test the telegram.Bot sendMessage method'''
|
||||
print('Testing sendMessage')
|
||||
|
@ -67,7 +66,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(isinstance(message.date, datetime))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testGetUpdates(self):
|
||||
'''Test the telegram.Bot getUpdates method'''
|
||||
print('Testing getUpdates')
|
||||
|
@ -78,7 +77,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(isinstance(updates[0], telegram.Update))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testForwardMessage(self):
|
||||
'''Test the telegram.Bot forwardMessage method'''
|
||||
print('Testing forwardMessage')
|
||||
|
@ -92,7 +91,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(isinstance(message.forward_date, datetime))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing sendPhoto - File')
|
||||
|
@ -105,7 +104,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, 'testSendPhoto')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testResendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing sendPhoto - Resend')
|
||||
|
@ -116,7 +115,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.photo[0].file_id, 'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendJPGURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendJPGURLPhoto - URL')
|
||||
|
@ -127,7 +126,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.photo[0].file_size, 822)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendPNGURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendPNGURLPhoto - URL')
|
||||
|
@ -138,7 +137,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendGIFURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendGIFURLPhoto - URL')
|
||||
|
@ -149,7 +148,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testSendChatAction(self):
|
||||
'''Test the telegram.Bot sendChatAction method'''
|
||||
print('Testing sendChatAction - ChatAction.TYPING')
|
||||
|
@ -158,7 +157,7 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
chat_id=self._chat_id)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def testGetUserProfilePhotos(self):
|
||||
'''Test the telegram.Bot getUserProfilePhotos method'''
|
||||
print('Testing getUserProfilePhotos')
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class DocumentTest(BaseTest, unittest.TestCase):
|
||||
|
@ -55,7 +54,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_document_png_file(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - PNG File')
|
||||
|
@ -73,7 +72,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_document_png_file_with_custom_file_name(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - PNG File with custom filename')
|
||||
|
@ -92,7 +91,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_document_url_gif_file(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - GIF File by URL')
|
||||
|
@ -110,7 +109,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.file_size, 3878)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_document_resend(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - Resend by file_id')
|
||||
|
@ -159,7 +158,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_document_empty_file(self):
|
||||
print('Testing bot.sendDocument - Null file')
|
||||
|
||||
|
@ -173,7 +172,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_document_empty_file_id(self):
|
||||
print('Testing bot.sendDocument - Empty file_id')
|
||||
|
||||
|
@ -187,7 +186,7 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_document_without_required_args(self):
|
||||
print('Testing bot.sendDocument - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class PhotoTest(BaseTest, unittest.TestCase):
|
||||
|
@ -57,7 +56,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_sendphotoo_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendPhoto - With all arguments')
|
||||
|
@ -85,7 +84,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_photo_jpg_file(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - JPG File')
|
||||
|
@ -110,7 +109,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_photo_url_jpg_file(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - JPG File by URL')
|
||||
|
@ -135,7 +134,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_photo_resend(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - Resend by file_id')
|
||||
|
@ -189,7 +188,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_photo_empty_file(self):
|
||||
print('Testing bot.sendPhoto - Null file')
|
||||
|
||||
|
@ -203,7 +202,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_photo_empty_file_id(self):
|
||||
print('Testing bot.sendPhoto - Empty file_id')
|
||||
|
||||
|
@ -217,7 +216,7 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_photo_without_required_args(self):
|
||||
print('Testing bot.sendPhoto - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class StickerTest(BaseTest, unittest.TestCase):
|
||||
|
@ -53,12 +52,12 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_sticker_file(self):
|
||||
pass
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_sticker_resend(self):
|
||||
"""Test telegram.Bot sendSticker method"""
|
||||
print('Testing bot.sendSticker - Resend by file_id')
|
||||
|
@ -107,7 +106,7 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(sticker['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_sticker_empty_file(self):
|
||||
print('Testing bot.sendSticker - Null file')
|
||||
|
||||
|
@ -121,7 +120,7 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_sticker_empty_file_id(self):
|
||||
print('Testing bot.sendSticker - Empty file_id')
|
||||
|
||||
|
@ -135,7 +134,7 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_sticker_without_required_args(self):
|
||||
print('Testing bot.sendSticker - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class VideoTest(BaseTest, unittest.TestCase):
|
||||
|
@ -59,7 +58,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_required_args_only(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - With required arguments only')
|
||||
|
@ -79,7 +78,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(video.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendVideo - With all arguments')
|
||||
|
@ -103,7 +102,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_mp4_file(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File')
|
||||
|
@ -127,7 +126,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_mp4_file_with_custom_filename(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File with custom filename')
|
||||
|
@ -152,7 +151,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_mp4_file_url(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File by URL')
|
||||
|
@ -176,7 +175,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_video_resend(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - Resend by file_id')
|
||||
|
@ -232,7 +231,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(video['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_video_empty_file(self):
|
||||
print('Testing bot.sendVideo - Null file')
|
||||
|
||||
|
@ -246,7 +245,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_video_empty_file_id(self):
|
||||
print('Testing bot.sendVideo - Empty file_id')
|
||||
|
||||
|
@ -260,7 +259,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_video_without_required_args(self):
|
||||
print('Testing bot.sendVideo - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from tests.base import BaseTest, timeout
|
||||
|
||||
|
||||
class VoiceTest(BaseTest, unittest.TestCase):
|
||||
|
@ -50,7 +49,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_required_args_only(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - With required arguments only')
|
||||
|
@ -67,7 +66,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendVoice - With all arguments')
|
||||
|
@ -87,7 +86,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_ogg_file(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File')
|
||||
|
@ -105,7 +104,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_ogg_file_with_custom_filename(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File with custom filename')
|
||||
|
@ -124,7 +123,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_ogg_url_file(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File by URL')
|
||||
|
@ -142,7 +141,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_send_voice_resend(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Resend by file_id')
|
||||
|
@ -189,7 +188,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_voice_empty_file(self):
|
||||
print('Testing bot.sendVoice - Null file')
|
||||
|
||||
|
@ -203,7 +202,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_send_voice_empty_file_id(self):
|
||||
print('Testing bot.sendVoice - Empty file_id')
|
||||
|
||||
|
@ -217,7 +216,7 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
@timeout(10)
|
||||
def test_error_voice_without_required_args(self):
|
||||
print('Testing bot.sendVoice - Without required arguments')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue