Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 851cad7

Browse files
committed
Make test_logging no longer fail if zlib not present. Closes #14256. Patch by Pedro Kroger.
1 parent b69ef16 commit 851cad7

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lib/test/test_logging.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@
3939
import struct
4040
import sys
4141
import tempfile
42-
from test.support import captured_stdout, run_with_locale, run_unittest, patch
43-
from test.support import TestHandler, Matcher
42+
from test.support import (captured_stdout, run_with_locale, run_unittest,
43+
patch, requires_zlib, TestHandler, Matcher)
4444
import textwrap
4545
import time
4646
import unittest
4747
import warnings
4848
import weakref
49-
import zlib
5049
try:
5150
import threading
5251
# The following imports are needed only for tests which
@@ -70,6 +69,10 @@
7069
except ImportError:
7170
win32evtlogutil = None
7271
win32evtlog = None
72+
try:
73+
import zlib
74+
except ImportError:
75+
pass
7376

7477

7578
class BaseTest(unittest.TestCase):
@@ -3602,6 +3605,7 @@ def namer(name):
36023605
self.assertFalse(os.path.exists(namer(self.fn + ".3")))
36033606
rh.close()
36043607

3608+
@requires_zlib
36053609
def test_rotator(self):
36063610
def namer(name):
36073611
return name + ".gz"

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ Holger Krekel
559559
Michael Kremer
560560
Fabian Kreutz
561561
Cédric Krier
562+
Pedro Kroger
562563
Hannu Krosing
563564
Andrej Krpic
564565
Ivan Krstić

0 commit comments

Comments
 (0)