Remove references to travis and appveyor (#1791)

This commit is contained in:
Bibo-Joshi 2020-02-23 22:04:56 +01:00 committed by GitHub
parent 1dc67dcbda
commit 8d6970ab02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 111 deletions

View file

@ -34,11 +34,6 @@ from telegram.ext import Dispatcher, JobQueue, Updater, BaseFilter, Defaults
from telegram.utils.helpers import _UtcOffsetTimezone
from tests.bots import get_bot
TRAVIS = os.getenv('TRAVIS', False)
if TRAVIS:
pytest_plugins = ['tests.travis_fold']
GITHUB_ACTION = os.getenv('GITHUB_ACTION', False)
if GITHUB_ACTION:

View file

@ -16,8 +16,6 @@
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
import os
import sys
import time
import datetime as dtm
from platform import python_implementation
@ -493,8 +491,6 @@ class TestBot(object):
@flaky(3, 1)
@pytest.mark.timeout(15)
@pytest.mark.xfail
@pytest.mark.skipif(os.getenv('APPVEYOR') and (sys.version_info < (3, 6)),
reason='only run on 3.6 on appveyor')
def test_set_webhook_get_webhook_info_and_delete_webhook(self, bot):
url = 'https://python-telegram-bot.org/test/webhook'
max_connections = 7

View file

@ -40,7 +40,6 @@ def job_queue(bot, _dp):
jq.stop()
@pytest.mark.skipif(os.getenv('APPVEYOR'), reason="On Appveyor precise timings are not accurate.")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS', False) and os.name == 'nt',
reason="On windows precise timings are not accurate.")
@flaky(10, 1) # Timings aren't quite perfect

View file

@ -25,7 +25,6 @@ import pytest
import telegram.ext.messagequeue as mq
@pytest.mark.skipif(os.getenv('APPVEYOR'), reason="On Appveyor precise timings are not accurate.")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS', False) and os.name == 'nt',
reason="On windows precise timings are not accurate.")
class TestDelayQueue(object):

View file

@ -150,7 +150,7 @@ class TestUpdater(object):
monkeypatch.setattr('telegram.ext.Dispatcher.process_update', lambda _, u: q.put(u))
ip = '127.0.0.1'
port = randrange(1024, 49152) # Select random port for travis
port = randrange(1024, 49152) # Select random port
updater.start_webhook(
ip,
port,
@ -186,7 +186,7 @@ class TestUpdater(object):
monkeypatch.setattr(updater.bot, 'set_webhook', lambda *args, **kwargs: True)
monkeypatch.setattr(updater.bot, 'delete_webhook', lambda *args, **kwargs: True)
ip = '127.0.0.1'
port = randrange(1024, 49152) # Select random port for travis
port = randrange(1024, 49152) # Select random port
tg_err = False
try:
updater._start_webhook(
@ -210,7 +210,7 @@ class TestUpdater(object):
monkeypatch.setattr('telegram.ext.Dispatcher.process_update', lambda _, u: q.put(u))
ip = '127.0.0.1'
port = randrange(1024, 49152) # Select random port for travis
port = randrange(1024, 49152) # Select random port
updater.start_webhook(ip, port, webhook_url=None)
sleep(.2)
@ -230,7 +230,7 @@ class TestUpdater(object):
monkeypatch.setattr('telegram.ext.Dispatcher.process_update', lambda _, u: q.put(u))
ip = '127.0.0.1'
port = randrange(1024, 49152) # Select random port for travis
port = randrange(1024, 49152) # Select random port
updater.start_webhook(
ip,
port,

View file

@ -1,96 +0,0 @@
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
import time
from collections import defaultdict
import _pytest.config
import pytest
fold_plugins = {'_cov': 'Coverage report', 'flaky': 'Flaky report'}
def terminal_summary_wrapper(original, plugin_name):
text = fold_plugins[plugin_name]
def pytest_terminal_summary(terminalreporter):
terminalreporter.write('travis_fold:start:plugin.{}\n{}\n'.format(plugin_name, text))
original(terminalreporter)
terminalreporter.write('travis_fold:end:plugin.{}\n'.format(plugin_name))
return pytest_terminal_summary
@pytest.mark.trylast
def pytest_configure(config):
for hookimpl in config.pluginmanager.hook.pytest_terminal_summary._nonwrappers:
if hookimpl.plugin_name in fold_plugins.keys():
hookimpl.function = terminal_summary_wrapper(hookimpl.function,
hookimpl.plugin_name)
terminal = None
previous_name = None
failed = set()
durations = defaultdict(int)
def _get_name(location):
return '{}::{}'.format(location[0], location[2].split('.')[0].split('[')[0])
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_runtest_makereport(item, call):
outcome = yield
rep = outcome.get_result()
name = _get_name(item.location)
durations[name] += rep.duration
if rep.failed:
global failed
failed.add(name)
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_runtest_protocol(item, nextitem):
# This is naughty but pytests' own plugins does something similar too, so who cares
global terminal
if terminal is None:
terminal = _pytest.config.create_terminal_writer(item.config)
global previous_name
name = _get_name(item.location)
if previous_name is None or previous_name != name:
previous_name = name
terminal.write('\ntravis_fold:start:{}\r'.format(name.split('::')[1]))
terminal.write('travis_time:start:{}time\r'.format(name.split('::')[1]))
terminal.write(name)
yield
if nextitem is None or _get_name(nextitem.location) != name:
global failed
if name in failed:
terminal.write('')
else:
terminal.write('\n\ntravis_fold:end:{}'.format(name.split('::')[1]))
terminal.write('\rtravis_time:end:{}time:'
'duration={}'.format(name.split('::')[1],
int(durations[name] * 1E9)))
time.sleep(0.001) # Tiny sleep so travis hopefully doesn't mangle the log