oslo.privsep: Add patch to fix tests with python 3.8

Change-Id: I766543232a4c09c57b8f3184eaa202c2af8fb614
This commit is contained in:
Dirk Mueller
2020-03-16 23:13:34 +01:00
parent a43ed17159
commit 4d0771a290
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
From 52747777df8e239d1096a42479e9eb82bd62437e Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Mon, 16 Mar 2020 23:08:51 +0100
Subject: [PATCH] Disable logger validation during unit testing
The unit tests set format to "dummy", which gets rejected by Python 3.8
by default due to newly added validation here:
https://github.com/python/cpython/commit/18fb1fb943b7dbd7f8a76017ee2a67ef13effb85
We can skip this and restore old behavior by disabling validation.
Change-Id: I22ba9c4437787c3f338f17a0b006132b0dd09df5
---
oslo_privsep/tests/test_daemon.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/oslo_privsep/tests/test_daemon.py b/oslo_privsep/tests/test_daemon.py
index f6e4d23..c2b3efd 100644
--- a/oslo_privsep/tests/test_daemon.py
+++ b/oslo_privsep/tests/test_daemon.py
@@ -18,6 +18,7 @@ import functools
import logging as pylogging
import mock
import platform
+import sys
import time
from oslo_log import formatters
@@ -59,6 +60,8 @@ def logme(level, msg, exc_info=False):
class LogRecorder(pylogging.Formatter):
def __init__(self, logs, *args, **kwargs):
+ if sys.version_info >= (3, 8):
+ kwargs['validate'] = False
super(LogRecorder, self).__init__(*args, **kwargs)
self.logs = logs
--
2.25.1

View File

@@ -11,6 +11,8 @@ License: {{ license('Apache-2.0') }}
Group: Development/Languages/Python
URL: https://launchpad.net/{{ pypi_name }}
Source0: {{ source }}
# https://review.opendev.org/#/c/713337/
Patch1: 0001-Disable-logger-validation-during-unit-testing.patch
BuildRequires: openstack-macros
BuildRequires: {{ py3('cffi') }}
BuildRequires: {{ py3('eventlet') }}