1616#
1717# You should have received a copy of the GNU Lesser Public License
1818# along with this program. If not, see [http://www.gnu.org/licenses/].
19+ import os
1920import time
2021from datetime import datetime , timedelta
2122from platform import python_implementation
2728from telegram import (Bot , Update , ChatAction , TelegramError , User , InlineKeyboardMarkup ,
2829 InlineKeyboardButton , InlineQueryResultArticle , InputTextMessageContent ,
2930 ShippingOption , LabeledPrice )
30- from telegram .error import BadRequest , InvalidToken , NetworkError , RetryAfter , TimedOut
31+ from telegram .error import BadRequest , InvalidToken , NetworkError , RetryAfter
3132from telegram .utils .helpers import from_timestamp
3233
3334BASE_TIME = time .time ()
@@ -148,6 +149,7 @@ def test_send_contact(self, bot, chat_id):
148149 assert message .contact .first_name == first_name
149150 assert message .contact .last_name == last_name
150151
152+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (' 'yet)' )
151153 @flaky (3 , 1 )
152154 @pytest .mark .timeout (10 )
153155 def test_send_game (self , bot , chat_id ):
@@ -191,14 +193,16 @@ def test(_, url, data, *args, **kwargs):
191193
192194 @flaky (3 , 1 )
193195 @pytest .mark .timeout (10 )
194- def test_get_user_profile_photos (self , bot , chat_id ):
196+ def test_get_user_profile_photos (self , bot ):
197+ chat_id = 12173560 # hardcoded Leandro's chat_id
195198 user_profile_photos = bot .get_user_profile_photos (chat_id )
196199
197200 assert user_profile_photos .photos [0 ][0 ].file_size == 12421
198201
199202 @flaky (3 , 1 )
200203 @pytest .mark .timeout (10 )
201- def test_get_one_user_profile_photo (self , bot , chat_id ):
204+ def test_get_one_user_profile_photo (self , bot ):
205+ chat_id = 12173560 # hardcoded Leandro's chat_id
202206 user_profile_photos = bot .get_user_profile_photos (chat_id , offset = 0 , limit = 1 )
203207 assert user_profile_photos .photos [0 ][0 ].file_size == 12421
204208
@@ -364,6 +368,7 @@ def test_get_chat_member(self, bot, channel_id):
364368 assert chat_member .status == 'administrator'
365369 assert chat_member .user .username == 'EchteEldin'
366370
371+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
367372 @flaky (3 , 1 )
368373 @pytest .mark .timeout (10 )
369374 def test_set_game_score_1 (self , bot , chat_id ):
@@ -382,6 +387,7 @@ def test_set_game_score_1(self, bot, chat_id):
382387 assert message .game .photo [0 ].file_size == game .game .photo [0 ].file_size
383388 assert message .game .text != game .game .text
384389
390+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
385391 @flaky (3 , 1 )
386392 @pytest .mark .timeout (10 )
387393 def test_set_game_score_2 (self , bot , chat_id ):
@@ -403,6 +409,7 @@ def test_set_game_score_2(self, bot, chat_id):
403409 assert message .game .photo [0 ].file_size == game .game .photo [0 ].file_size
404410 assert message .game .text == game .game .text
405411
412+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
406413 @flaky (3 , 1 )
407414 @pytest .mark .timeout (10 )
408415 def test_set_game_score_3 (self , bot , chat_id ):
@@ -419,6 +426,7 @@ def test_set_game_score_3(self, bot, chat_id):
419426 chat_id = game .chat_id ,
420427 message_id = game .message_id )
421428
429+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
422430 @flaky (3 , 1 )
423431 @pytest .mark .timeout (10 )
424432 def test_set_game_score_4 (self , bot , chat_id ):
@@ -444,6 +452,7 @@ def test_set_game_score_4(self, bot, chat_id):
444452 game2 = bot .send_game (chat_id , game_short_name )
445453 assert str (score ) in game2 .game .text
446454
455+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
447456 @flaky (3 , 1 )
448457 @pytest .mark .timeout (10 )
449458 def test_set_game_score_too_low_score (self , bot , chat_id ):
@@ -455,6 +464,7 @@ def test_set_game_score_too_low_score(self, bot, chat_id):
455464 bot .set_game_score (user_id = chat_id , score = 100 ,
456465 chat_id = game .chat_id , message_id = game .message_id )
457466
467+ @pytest .mark .skipif (os .getenv ('APPVEYOR' ), reason = 'No game made for Appveyor bot (yet)' )
458468 @flaky (3 , 1 )
459469 @pytest .mark .timeout (10 )
460470 def test_get_game_high_scores (self , bot , chat_id ):
0 commit comments