2023-08-30 05:27:21 +00:00
|
|
|
From da6e8ccb688b3755285ba42a3d5518f1f3a5f6ff Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Steve Kowalik <steven@wedontsleep.org>
|
|
|
|
|
Date: Wed, 30 Aug 2023 14:08:03 +1000
|
|
|
|
|
Subject: [PATCH] pytest-server-fixtures: Remove six and future
|
|
|
|
|
|
|
|
|
|
Now that we only support Python 3.6 and above, we can stop using
|
|
|
|
|
crutches like six and future.
|
|
|
|
|
---
|
|
|
|
|
pytest-server-fixtures/pytest_server_fixtures/base.py | 6 ++----
|
|
|
|
|
pytest-server-fixtures/pytest_server_fixtures/http.py | 8 +++-----
|
|
|
|
|
pytest-server-fixtures/pytest_server_fixtures/jenkins.py | 3 +--
|
|
|
|
|
pytest-server-fixtures/pytest_server_fixtures/postgres.py | 5 ++---
|
|
|
|
|
pytest-server-fixtures/pytest_server_fixtures/s3.py | 5 ++---
|
|
|
|
|
pytest-server-fixtures/setup.py | 2 --
|
|
|
|
|
6 files changed, 10 insertions(+), 19 deletions(-)
|
|
|
|
|
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/base.py
|
2022-12-09 10:53:29 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/base.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/base.py
|
2022-12-09 10:53:29 +00:00
|
|
|
@@ -14,8 +14,6 @@ import logging
|
|
|
|
|
import random
|
|
|
|
|
import errno
|
|
|
|
|
|
|
|
|
|
-from six import string_types
|
|
|
|
|
-
|
|
|
|
|
from pytest_server_fixtures import CONFIG
|
|
|
|
|
from pytest_shutil.workspace import Workspace
|
|
|
|
|
|
2024-10-22 06:11:08 +00:00
|
|
|
@@ -112,7 +110,7 @@ class ProcessReader(threading.Thread):
|
2022-12-09 10:53:29 +00:00
|
|
|
def run(self):
|
|
|
|
|
while self.process.poll() is None:
|
|
|
|
|
l = self.stream.readline()
|
|
|
|
|
- if not isinstance(l, string_types):
|
2024-10-22 06:11:08 +00:00
|
|
|
+ if not isinstance(l, str):
|
2022-12-09 10:53:29 +00:00
|
|
|
l = l.decode('utf-8')
|
|
|
|
|
|
|
|
|
|
if l.strip():
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/http.py
|
2022-12-09 10:53:29 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/http.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/http.py
|
2023-08-30 05:27:21 +00:00
|
|
|
@@ -1,5 +1,4 @@
|
|
|
|
|
-from __future__ import print_function
|
|
|
|
|
-
|
|
|
|
|
+import http.client
|
|
|
|
|
import os
|
|
|
|
|
import socket
|
|
|
|
|
import logging
|
|
|
|
|
@@ -9,7 +8,6 @@ import sys
|
2022-12-09 10:53:29 +00:00
|
|
|
import pytest
|
|
|
|
|
import requests
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
-from six.moves import http_client
|
|
|
|
|
|
|
|
|
|
from pytest_shutil.env import unset_env
|
|
|
|
|
from pytest_server_fixtures import CONFIG
|
2023-08-30 05:27:21 +00:00
|
|
|
@@ -83,7 +81,7 @@ class HTTPTestServer(TestServer):
|
2022-12-09 10:53:29 +00:00
|
|
|
with self.handle_proxy():
|
|
|
|
|
returned = requests.get('http://%s:%d/%s' % (self.hostname, self.port, path))
|
|
|
|
|
return returned.json() if as_json else returned
|
|
|
|
|
- except (http_client.BadStatusLine, requests.ConnectionError) as e:
|
|
|
|
|
+ except (http.client.BadStatusLine, requests.ConnectionError) as e:
|
|
|
|
|
time.sleep(int(i) / 10)
|
|
|
|
|
pass
|
|
|
|
|
raise e
|
2024-10-22 06:11:08 +00:00
|
|
|
@@ -109,7 +107,7 @@ class HTTPTestServer(TestServer):
|
2022-12-09 10:53:29 +00:00
|
|
|
with self.handle_proxy():
|
2024-10-22 06:11:08 +00:00
|
|
|
returned = requests.post('http://%s:%d/%s' % (self.hostname, self.port, path), data=data, headers=headers)
|
2022-12-09 10:53:29 +00:00
|
|
|
return returned.json() if as_json else returned
|
|
|
|
|
- except (http_client.BadStatusLine, requests.ConnectionError) as e:
|
|
|
|
|
+ except (http.client.BadStatusLine, requests.ConnectionError) as e:
|
|
|
|
|
time.sleep(int(i) / 10)
|
|
|
|
|
pass
|
|
|
|
|
raise e
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/jenkins.py
|
2022-12-09 10:53:29 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/jenkins.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/jenkins.py
|
2022-12-09 10:53:29 +00:00
|
|
|
@@ -9,7 +9,6 @@ import os.path
|
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
-import six
|
|
|
|
|
|
|
|
|
|
from pytest_server_fixtures import CONFIG
|
|
|
|
|
from pytest_fixture_config import yield_requires_config
|
|
|
|
|
@@ -95,7 +94,7 @@ class JenkinsTestServer(HTTPTestServer):
|
|
|
|
|
if plugins is None:
|
|
|
|
|
plugins = available_plugins.keys()
|
|
|
|
|
else:
|
|
|
|
|
- if isinstance(plugins, six.string_types):
|
|
|
|
|
+ if isinstance(plugins, str):
|
|
|
|
|
plugins = [plugins]
|
|
|
|
|
|
|
|
|
|
errors = []
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/postgres.py
|
2022-12-09 10:53:29 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/postgres.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/postgres.py
|
2022-12-09 10:53:29 +00:00
|
|
|
@@ -8,7 +8,6 @@ import subprocess
|
|
|
|
|
|
|
|
|
|
import errno
|
|
|
|
|
import pytest
|
|
|
|
|
-from six import text_type
|
|
|
|
|
|
|
|
|
|
from pytest_server_fixtures import CONFIG
|
|
|
|
|
from pytest_fixture_config import requires_config
|
|
|
|
|
@@ -65,7 +64,7 @@ class PostgresServer(TestServer):
|
|
|
|
|
try:
|
|
|
|
|
self.pg_bin = subprocess.check_output([CONFIG.pg_config_executable, "--bindir"]).decode('utf-8').rstrip()
|
|
|
|
|
except OSError as e:
|
|
|
|
|
- msg = "Failed to get pg_config --bindir: " + text_type(e)
|
|
|
|
|
+ msg = "Failed to get pg_config --bindir: " + str(e)
|
|
|
|
|
print(msg)
|
|
|
|
|
self._fail(msg)
|
|
|
|
|
initdb_path = self.pg_bin + '/initdb'
|
|
|
|
|
@@ -76,7 +75,7 @@ class PostgresServer(TestServer):
|
|
|
|
|
try:
|
|
|
|
|
subprocess.check_call([initdb_path, str(self.workspace / 'db')])
|
|
|
|
|
except OSError as e:
|
|
|
|
|
- msg = "Failed to launch postgres: " + text_type(e)
|
|
|
|
|
+ msg = "Failed to launch postgres: " + str(e)
|
|
|
|
|
print(msg)
|
|
|
|
|
self._fail(msg)
|
|
|
|
|
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/s3.py
|
2023-08-30 05:27:21 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/s3.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/s3.py
|
2023-08-30 05:27:21 +00:00
|
|
|
@@ -11,7 +11,6 @@ import logging
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
-from future.utils import text_type
|
|
|
|
|
from pytest_fixture_config import requires_config
|
|
|
|
|
|
|
|
|
|
from . import CONFIG
|
|
|
|
|
@@ -47,7 +46,7 @@ def s3_bucket(s3_server): # pylint: dis
|
|
|
|
|
returning a BucketInfo namedtuple with `s3_bucket.client` and `s3_bucket.name` fields
|
|
|
|
|
"""
|
|
|
|
|
client = s3_server.get_s3_client()
|
|
|
|
|
- bucket_name = text_type(uuid.uuid4())
|
|
|
|
|
+ bucket_name = str(uuid.uuid4())
|
|
|
|
|
client.create_bucket(Bucket=bucket_name)
|
|
|
|
|
return BucketInfo(client, bucket_name)
|
|
|
|
|
|
|
|
|
|
@@ -96,6 +95,6 @@ class MinioServer(HTTPTestServer):
|
|
|
|
|
"server",
|
|
|
|
|
"--address",
|
|
|
|
|
"{}:{}".format(self.hostname, self.port),
|
|
|
|
|
- text_type(self.datadir),
|
|
|
|
|
+ str(self.datadir),
|
|
|
|
|
]
|
|
|
|
|
return cmdargs
|
2024-10-22 06:11:08 +00:00
|
|
|
Index: pytest-server-fixtures-1.8.0/setup.py
|
2023-08-30 05:27:21 +00:00
|
|
|
===================================================================
|
2024-10-22 06:11:08 +00:00
|
|
|
--- pytest-server-fixtures-1.8.0.orig/setup.py
|
|
|
|
|
+++ pytest-server-fixtures-1.8.0/setup.py
|
|
|
|
|
@@ -20,8 +20,6 @@ classifiers = [
|
2023-08-30 05:27:21 +00:00
|
|
|
install_requires = ['pytest',
|
|
|
|
|
'pytest-shutil',
|
|
|
|
|
'pytest-fixture-config',
|
|
|
|
|
- 'six',
|
|
|
|
|
- 'future',
|
|
|
|
|
'requests',
|
|
|
|
|
'retry',
|
|
|
|
|
'psutil',
|