Skip to content

Commit 605f08a

Browse files
committed
Drop Python 2.7 test variant
1 parent ae95ae4 commit 605f08a

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

tests/core/test_logging.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
import logging
66
import logging.config
77
import os
8-
import sys
98
import textwrap
109

1110
import jsonschema
12-
import pytest
1311

1412
from dockerflow.logging import JsonLogFormatter
1513

@@ -119,10 +117,9 @@ def test_logging_error_tracebacks(caplog):
119117
assert "ValueError" in details["Fields"]["traceback"]
120118

121119

122-
@pytest.mark.skipif(sys.version_info < (3, 5), reason="Requires python >= 3.5")
123-
def test_logging_exc_info_false_3x(caplog):
120+
def test_logging_exc_info_false(caplog):
124121
"""Ensure log formatter does not fail and does not include exception
125-
traceback information when exc_info is False under Python 3.x"""
122+
traceback information when exc_info is False"""
126123
try:
127124
raise ValueError("\n")
128125
except Exception:
@@ -135,25 +132,6 @@ def test_logging_exc_info_false_3x(caplog):
135132
assert "traceback" not in details["Fields"]
136133

137134

138-
@pytest.mark.skipif(sys.version_info >= (3,), reason="Requires python 2")
139-
def test_logging_exc_info_false_2x(caplog):
140-
"""Ensure log formatter does not fail *but* still includes exception
141-
traceback information when exc_info is False under Python 2.x"""
142-
try:
143-
raise ValueError("\n")
144-
except Exception:
145-
logging.exception("there was an error", exc_info=False)
146-
details = assert_records(caplog.records)
147-
148-
assert details["Severity"] == 3
149-
assert details["Fields"]["msg"] == "there was an error"
150-
# In Python 2, when exc_info=False is passed, we still see a tuple in the
151-
# formatter, so we still include the error and traceback keys.
152-
assert details["Fields"]["error"].startswith("ValueError('\\n'")
153-
assert details["Fields"]["traceback"].startswith("Uncaught exception:")
154-
assert "ValueError" in details["Fields"]["traceback"]
155-
156-
157135
def test_ignore_json_message(caplog):
158136
"""Ensure log formatter ignores messages that are JSON already"""
159137
try:

0 commit comments

Comments
 (0)