forked from pool/python-pytest-server-fixtures
- Update to 1.8.0:
* Drop support for Python 2 and <3.6, removing compatibility code.
* Use stdlib unittest.mock instead of mock package.
* Removed usage of path.py and path in favour of pathlib.
* BREAKING CHANGE: Removed RethinkDB support, as the mirror was no longer
available.
* Allowed passing through HTTP headers to the server.
* Fixed threading log debug messages.
* Removed usage of deprecated Thread.setDaemon.
* Explicitly close initial Mongo client.
* Don't use context manager for CREATE DATABASE
- Drop patches, included upstream:
* pytest-plugins-pr186-fix-psycopg29.patch
* remove-mock.patch
- Refreshed remove-six-and-future.patch
- Add patch fix-httpd-fixture-path.patch:
* Attempt to run httpd with the correct config file
- Add patch support-64-bit-pids-xvfb.patch:
* Support 64 bit PIDs when running Xvfb
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-server-fixtures?expand=0&rev=20
This commit is contained in:
13
fix-httpd-fixture-path.patch
Normal file
13
fix-httpd-fixture-path.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/httpd.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/httpd.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/httpd.py
|
||||
@@ -161,7 +161,7 @@ class HTTPDServer(HTTPTestServer):
|
||||
|
||||
@property
|
||||
def run_cmd(self):
|
||||
- return [CONFIG.httpd_executable, '-f', self.config]
|
||||
+ return [CONFIG.httpd_executable, '-f', str(self.config)]
|
||||
|
||||
def kill(self, retries=5):
|
||||
pid = self.pid
|
||||
@@ -1,43 +0,0 @@
|
||||
From 291995b3cfe60a5b30d5c6e1f3279ea40d35c7bb Mon Sep 17 00:00:00 2001
|
||||
From: Ben Greiner <code@bnavigator.de>
|
||||
Date: Sun, 17 Oct 2021 18:57:06 +0200
|
||||
Subject: [PATCH] Don't use context manager for CREATE DATABASE
|
||||
|
||||
Psycopg 2.9 uses transaction blocks withing context managers,
|
||||
which is not allowed for CREATE DATABASE
|
||||
https://github.com/psycopg/psycopg2/issues/941
|
||||
---
|
||||
.../pytest_server_fixtures/postgres.py | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/pytest-server-fixtures/pytest_server_fixtures/postgres.py b/pytest-server-fixtures/pytest_server_fixtures/postgres.py
|
||||
index 7c6ea33d..aeab36ad 100644
|
||||
--- a/pytest_server_fixtures/postgres.py
|
||||
+++ b/pytest_server_fixtures/postgres.py
|
||||
@@ -103,18 +103,22 @@ def run_cmd(self):
|
||||
|
||||
def check_server_up(self):
|
||||
from psycopg2 import OperationalError
|
||||
+ conn = None
|
||||
try:
|
||||
print("Connecting to Postgres at localhost:{}".format(self.port))
|
||||
- with self.connect('postgres') as conn:
|
||||
- conn.set_session(autocommit=True)
|
||||
- with conn.cursor() as cursor:
|
||||
- cursor.execute("CREATE DATABASE " + self.database_name)
|
||||
+ conn = self.connect('postgres')
|
||||
+ conn.set_session(autocommit=True)
|
||||
+ with conn.cursor() as cursor:
|
||||
+ cursor.execute("CREATE DATABASE " + self.database_name)
|
||||
self.connection = self.connect(self.database_name)
|
||||
with open(self.workspace / 'db' / 'postmaster.pid', 'r') as f:
|
||||
self.pid = int(f.readline().rstrip())
|
||||
return True
|
||||
except OperationalError as e:
|
||||
print("Could not connect to test postgres: {}".format(e))
|
||||
+ finally:
|
||||
+ if conn:
|
||||
+ conn.close()
|
||||
return False
|
||||
|
||||
def connect(self, database=None):
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0fa5b1be6a84180e50ff91a58580e81ad3eb45828878a07942fbe384fcd86d1f
|
||||
size 9801739
|
||||
3
pytest-server-fixtures-1.8.0.tar.gz
Normal file
3
pytest-server-fixtures-1.8.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0b1786087f481c7dfa03678090fc57ec7cff7e61f41f28960c188af219a14280
|
||||
size 9810031
|
||||
@@ -1,3 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 22 06:08:51 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 1.8.0:
|
||||
* Drop support for Python 2 and <3.6, removing compatibility code.
|
||||
* Use stdlib unittest.mock instead of mock package.
|
||||
* Removed usage of path.py and path in favour of pathlib.
|
||||
* BREAKING CHANGE: Removed RethinkDB support, as the mirror was no longer
|
||||
available.
|
||||
* Allowed passing through HTTP headers to the server.
|
||||
* Fixed threading log debug messages.
|
||||
* Removed usage of deprecated Thread.setDaemon.
|
||||
* Explicitly close initial Mongo client.
|
||||
* Don't use context manager for CREATE DATABASE
|
||||
- Drop patches, included upstream:
|
||||
* pytest-plugins-pr186-fix-psycopg29.patch
|
||||
* remove-mock.patch
|
||||
- Refreshed remove-six-and-future.patch
|
||||
- Add patch fix-httpd-fixture-path.patch:
|
||||
* Attempt to run httpd with the correct config file
|
||||
- Add patch support-64-bit-pids-xvfb.patch:
|
||||
* Support 64 bit PIDs when running Xvfb
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 30 05:26:54 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-pytest-server-fixtures
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -17,18 +17,18 @@
|
||||
|
||||
|
||||
Name: python-pytest-server-fixtures
|
||||
Version: 1.7.0
|
||||
Version: 1.8.0
|
||||
Release: 0
|
||||
Summary: Extensible server fixtures for pytest
|
||||
License: MIT
|
||||
URL: https://github.com/man-group/pytest-plugins
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-server-fixtures/pytest-server-fixtures-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM pytest-plugins-pr186-fix-psycopg29.patch -- gh#man-group/pytest-plugins#186
|
||||
Patch0: pytest-plugins-pr186-fix-psycopg29.patch
|
||||
# PATCH-FIX-UPSTREAM remove-mock.patch -- gh#man-group#pytest-plugins#171
|
||||
Patch1: remove-mock.patch
|
||||
# PATCH-FIX-UPSTREAM gh#github.com/man-group/pytest-plugins#221
|
||||
Patch2: remove-six-and-future.patch
|
||||
Patch0: remove-six-and-future.patch
|
||||
# PATCH-FIX-UPSTREAM gh#man-group/pytest-plugins#249
|
||||
Patch1: fix-httpd-fixture-path.patch
|
||||
# PATCH-FIX-UPSTREAM gh#man-group/pytest-plugins#250
|
||||
Patch2: support-64-bit-pids-xvfb.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools-git}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
@@ -54,7 +54,6 @@ Suggests: python-psycopg2
|
||||
Suggests: python-pymongo >= 3.6.0
|
||||
Suggests: python-python-jenkins
|
||||
Suggests: python-redis
|
||||
Suggests: python-rethinkdb
|
||||
Suggests: redis
|
||||
Suggests: xauth
|
||||
Suggests: xdpyinfo
|
||||
@@ -73,7 +72,6 @@ BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module python-jenkins}
|
||||
BuildRequires: %{python_module redis}
|
||||
BuildRequires: %{python_module requests}
|
||||
BuildRequires: %{python_module rethinkdb}
|
||||
BuildRequires: %{python_module retry}
|
||||
BuildRequires: apache2
|
||||
BuildRequires: lsof
|
||||
@@ -95,7 +93,6 @@ Extensible server fixtures for pytest
|
||||
# Tests requiring a server
|
||||
rm tests/integration/test_mongo_server.py
|
||||
rm tests/integration/test_jenkins_server.py
|
||||
rm tests/integration/test_rethink_server.py
|
||||
rm tests/integration/test_s3_server.py
|
||||
rm tests/unit/serverclass/test_kubernetes_unit.py
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
Index: a/tests/integration/test_xvfb_server.py
|
||||
===================================================================
|
||||
--- a/tests/integration/test_xvfb_server.py
|
||||
+++ b/tests/integration/test_xvfb_server.py
|
||||
@@ -4,7 +4,11 @@ import time
|
||||
|
||||
from itertools import chain, repeat
|
||||
|
||||
-from mock import patch
|
||||
+try:
|
||||
+ from unittest.mock import patch
|
||||
+except ImportError:
|
||||
+ from mock import patch
|
||||
+
|
||||
import pytest
|
||||
from pytest import raises
|
||||
|
||||
Index: a/tests/unit/serverclass/test_docker_unit.py
|
||||
===================================================================
|
||||
--- a/tests/unit/serverclass/test_docker_unit.py
|
||||
+++ b/tests/unit/serverclass/test_docker_unit.py
|
||||
@@ -1,4 +1,8 @@
|
||||
-from mock import sentinel, patch, Mock
|
||||
+try:
|
||||
+ from unittest.mock import sentinel, patch, Mock
|
||||
+except ImportError:
|
||||
+ from mock import sentinel, patch, Mock
|
||||
+
|
||||
|
||||
from pytest_server_fixtures.serverclass.docker import DockerServer
|
||||
|
||||
Index: a/tests/unit/serverclass/test_thread_unit.py
|
||||
===================================================================
|
||||
--- a/tests/unit/serverclass/test_thread_unit.py
|
||||
+++ b/tests/unit/serverclass/test_thread_unit.py
|
||||
@@ -1,4 +1,8 @@
|
||||
-from mock import sentinel, patch, Mock
|
||||
+try:
|
||||
+ from unittest.mock import sentinel, patch, Mock
|
||||
+except ImportError:
|
||||
+ from mock import sentinel, patch, Mock
|
||||
+
|
||||
|
||||
from pytest_server_fixtures import CONFIG
|
||||
from pytest_server_fixtures.serverclass.thread import ThreadServer
|
||||
Index: a/tests/unit/test_server_unit.py
|
||||
===================================================================
|
||||
--- a/tests/unit/test_server_unit.py
|
||||
+++ b/tests/unit/test_server_unit.py
|
||||
@@ -1,4 +1,8 @@
|
||||
-from mock import create_autospec, sentinel, call, patch, Mock
|
||||
+try:
|
||||
+ from unittest.mock import create_autospec, sentinel, call, patch, Mock
|
||||
+except ImportError:
|
||||
+ from mock import create_autospec, sentinel, call, patch, Mock
|
||||
+
|
||||
|
||||
from pytest_server_fixtures.base import TestServer as _TestServer # So that pytest doesnt think this is a test case
|
||||
|
||||
Index: tests/unit/test_server_v2_unit.py
|
||||
===================================================================
|
||||
--- a/tests/unit/test_server_v2_unit.py
|
||||
+++ b/tests/unit/test_server_v2_unit.py
|
||||
@@ -1,4 +1,8 @@
|
||||
-from mock import create_autospec, sentinel, call, patch, Mock
|
||||
+try:
|
||||
+ from unittest.mock import create_autospec, sentinel, call, patch, Mock
|
||||
+except ImportError:
|
||||
+ from mock import create_autospec, sentinel, call, patch, Mock
|
||||
+
|
||||
|
||||
from pytest_server_fixtures.base2 import TestServerV2 as _TestServerV2 # TODO: why as _TestServerV2?
|
||||
|
||||
@@ -14,10 +14,10 @@ crutches like six and future.
|
||||
pytest-server-fixtures/setup.py | 2 --
|
||||
6 files changed, 10 insertions(+), 19 deletions(-)
|
||||
|
||||
Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/base.py
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/base.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/pytest_server_fixtures/base.py
|
||||
+++ pytest-server-fixtures-1.7.0/pytest_server_fixtures/base.py
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/base.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/base.py
|
||||
@@ -14,8 +14,6 @@ import logging
|
||||
import random
|
||||
import errno
|
||||
@@ -27,26 +27,19 @@ Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/base.py
|
||||
from pytest_server_fixtures import CONFIG
|
||||
from pytest_shutil.workspace import Workspace
|
||||
|
||||
@@ -103,13 +101,13 @@ class ProcessReader(threading.Thread):
|
||||
self.stderr = stderr
|
||||
self.process = process
|
||||
self.stream = stream
|
||||
- super(ProcessReader, self).__init__()
|
||||
+ super().__init__()
|
||||
self.setDaemon(True)
|
||||
|
||||
@@ -112,7 +110,7 @@ class ProcessReader(threading.Thread):
|
||||
def run(self):
|
||||
while self.process.poll() is None:
|
||||
l = self.stream.readline()
|
||||
- if not isinstance(l, string_types):
|
||||
+ if not isinstance(l, six):
|
||||
+ if not isinstance(l, str):
|
||||
l = l.decode('utf-8')
|
||||
|
||||
if l.strip():
|
||||
Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/http.py
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/http.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/pytest_server_fixtures/http.py
|
||||
+++ pytest-server-fixtures-1.7.0/pytest_server_fixtures/http.py
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/http.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/http.py
|
||||
@@ -1,5 +1,4 @@
|
||||
-from __future__ import print_function
|
||||
-
|
||||
@@ -71,19 +64,19 @@ Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/http.py
|
||||
time.sleep(int(i) / 10)
|
||||
pass
|
||||
raise e
|
||||
@@ -107,7 +105,7 @@ class HTTPTestServer(TestServer):
|
||||
@@ -109,7 +107,7 @@ class HTTPTestServer(TestServer):
|
||||
with self.handle_proxy():
|
||||
returned = requests.post('http://%s:%d/%s' % (self.hostname, self.port, path), data=data)
|
||||
returned = requests.post('http://%s:%d/%s' % (self.hostname, self.port, path), data=data, headers=headers)
|
||||
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
|
||||
Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/jenkins.py
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/jenkins.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/pytest_server_fixtures/jenkins.py
|
||||
+++ pytest-server-fixtures-1.7.0/pytest_server_fixtures/jenkins.py
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/jenkins.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/jenkins.py
|
||||
@@ -9,7 +9,6 @@ import os.path
|
||||
import shutil
|
||||
|
||||
@@ -101,10 +94,10 @@ Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/jenkins.py
|
||||
plugins = [plugins]
|
||||
|
||||
errors = []
|
||||
Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/postgres.py
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/postgres.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/pytest_server_fixtures/postgres.py
|
||||
+++ pytest-server-fixtures-1.7.0/pytest_server_fixtures/postgres.py
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/postgres.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/postgres.py
|
||||
@@ -8,7 +8,6 @@ import subprocess
|
||||
|
||||
import errno
|
||||
@@ -131,10 +124,10 @@ Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/postgres.py
|
||||
print(msg)
|
||||
self._fail(msg)
|
||||
|
||||
Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/s3.py
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/s3.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/pytest_server_fixtures/s3.py
|
||||
+++ pytest-server-fixtures-1.7.0/pytest_server_fixtures/s3.py
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/s3.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/s3.py
|
||||
@@ -11,7 +11,6 @@ import logging
|
||||
import os
|
||||
|
||||
@@ -160,11 +153,11 @@ Index: pytest-server-fixtures-1.7.0/pytest_server_fixtures/s3.py
|
||||
+ str(self.datadir),
|
||||
]
|
||||
return cmdargs
|
||||
Index: pytest-server-fixtures-1.7.0/setup.py
|
||||
Index: pytest-server-fixtures-1.8.0/setup.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.7.0.orig/setup.py
|
||||
+++ pytest-server-fixtures-1.7.0/setup.py
|
||||
@@ -25,8 +25,6 @@ classifiers = [
|
||||
--- pytest-server-fixtures-1.8.0.orig/setup.py
|
||||
+++ pytest-server-fixtures-1.8.0/setup.py
|
||||
@@ -20,8 +20,6 @@ classifiers = [
|
||||
install_requires = ['pytest',
|
||||
'pytest-shutil',
|
||||
'pytest-fixture-config',
|
||||
|
||||
16
support-64-bit-pids-xvfb.patch
Normal file
16
support-64-bit-pids-xvfb.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
Index: pytest-server-fixtures-1.8.0/pytest_server_fixtures/xvfb.py
|
||||
===================================================================
|
||||
--- pytest-server-fixtures-1.8.0.orig/pytest_server_fixtures/xvfb.py
|
||||
+++ pytest-server-fixtures-1.8.0/pytest_server_fixtures/xvfb.py
|
||||
@@ -43,7 +43,10 @@ class XvfbServer(object):
|
||||
|
||||
def __init__(self):
|
||||
tmpdir = mkdtemp(prefix='XvfbServer.', dir=Workspace.get_base_tempdir())
|
||||
- for servernum in range(os.getpid(), 65536):
|
||||
+ pid_max = 65536
|
||||
+ with open('/proc/sys/kernel/pid_max') as pid_max_file:
|
||||
+ pid_max = int(pid_max_file.read())
|
||||
+ for servernum in range(os.getpid(), pid_max):
|
||||
if os.path.exists('/tmp/.X{0}-lock'.format(servernum)):
|
||||
continue
|
||||
self.display = ':' + str(servernum)
|
||||
Reference in New Issue
Block a user