jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894639 )
Change subject: [tests] remove pytest-httpbin due to security vulnerability ......................................................................
[tests] remove pytest-httpbin due to security vulnerability
Bug: T331286 Change-Id: I876012a40686675185ccf3226e100edb920d88a9 --- M dev-requirements.txt M docs/tests_ref/index.rst D docs/tests_ref/conftest.rst M tests/aspects.py D tests/conftest.py 5 files changed, 12 insertions(+), 70 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/dev-requirements.txt b/dev-requirements.txt index 9624d74..f90ec6f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,13 +8,6 @@ pytest-runner pytest-subtests >= 0.3.2 pytest-attrib>=0.1.3 -# pytest-httpbin needs httpbin needs werkzeug >= 0.14.1 -# Python 3.8 needs werkzeug >= 0.15.5 -# httpbin 0.7 fails with werkzeug 2.1.0/1 (T305124) -werkzeug>=0.14.1, <2.1.0; python_version<"3.8" -werkzeug>=0.15.5, <2.1.0; python_version>="3.8" - -pytest-httpbin
pydocstyle>=4.0.0 flake8>=5.0.2 diff --git a/docs/tests_ref/conftest.rst b/docs/tests_ref/conftest.rst deleted file mode 100644 index 1b59bd6..0000000 --- a/docs/tests_ref/conftest.rst +++ /dev/null @@ -1,8 +0,0 @@ -********************* -tests.conftest module -********************* - -.. automodule:: tests.conftest - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/tests_ref/index.rst b/docs/tests_ref/index.rst index b957ade..5b492fe 100644 --- a/docs/tests_ref/index.rst +++ b/docs/tests_ref/index.rst @@ -28,7 +28,6 @@ bot<./bot_tests> cache<./cache_tests> category<./category_tests> - conftest cosmetic_changes<./cosmetic_changes_tests> date<./date_tests> diff<./diff_tests> diff --git a/tests/aspects.py b/tests/aspects.py index 5ab221c..3c5ca2f 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -52,17 +52,6 @@ )
-try: - import pytest_httpbin - optional_pytest_httpbin_cls_decorator = ( - pytest_httpbin.use_class_based_httpbin) -except ImportError: - pytest_httpbin = None - - def optional_pytest_httpbin_cls_decorator(f): - """Empty decorator in case pytest_httpbin is not installed.""" - return f - OSWIN32 = (sys.platform == 'win32') pywikibot.bot.set_interface('buffer')
@@ -474,20 +463,6 @@ if not hasattr(cls, 'sites'): return
- if issubclass(cls, HttpbinTestCase): - # If test uses httpbin, then check is pytest test runner is used - # and pytest_httpbin module is installed. - httpbin_used = hasattr(sys, - '_test_runner_pytest') and pytest_httpbin - else: - httpbin_used = False - - # If pytest_httpbin will be used during tests, then remove httpbin.org - # from sites. - if httpbin_used: - cls.sites = {k: v for k, v in cls.sites.items() - if 'httpbin.org' not in v['hostname']} - for key, data in cls.sites.items(): if 'hostname' not in data: raise Exception('{}: hostname not defined for {}' @@ -1570,7 +1545,6 @@ super().tearDown()
-@optional_pytest_httpbin_cls_decorator class HttpbinTestCase(TestCase):
""" @@ -1586,23 +1560,9 @@ }
def get_httpbin_url(self, path=''): - """ - Return url of httpbin. - - If pytest is used, returns url of local httpbin server. - Otherwise, returns: http://httpbin.org - """ - if hasattr(self, 'httpbin'): - return self.httpbin.url + path + """Return url of httpbin.""" return 'http://httpbin.org' + path
def get_httpbin_hostname(self): - """ - Return httpbin hostname. - - If pytest is used, returns hostname of local httpbin server. - Otherwise, returns: httpbin.org - """ - if hasattr(self, 'httpbin'): - return f'{self.httpbin.host}:{self.httpbin.port}' + """Return httpbin hostname.""" return 'httpbin.org' diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index 5356e7a..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Used by pytest to do some preparation work before running tests.""" -# -# (C) Pywikibot team, 2016-2020 -# -# Distributed under the terms of the MIT license. -# -import sys - - -def pytest_configure(config): - """Set the sys._test_runner_pytest flag to True, if pytest is used.""" - sys._test_runner_pytest = True
pywikibot-commits@lists.wikimedia.org