Merge ~d0ugal/maas:testtools-monkeypatch into maas:master

Proposed by Dougal Matthews
Status: Merged
Approved by: Dougal Matthews
Approved revision: 3bea79fdd5d3f0f1b8f88e0677f3f16963072bed
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~d0ugal/maas:testtools-monkeypatch
Merge into: maas:master
Diff against target: 54 lines (+0/-26)
2 files modified
src/maastesting/__init__.py (+0/-8)
src/maastesting/twisted.py (+0/-18)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Alberto Donato (community) Approve
Review via email: mp+393565@code.launchpad.net

Commit message

Remove the testtools monkeypatch that maybe fixed a bug

The upstream fix was landed in 2016 and included in testtools 2.4.0

To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) wrote :

+1

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b testtools-monkeypatch lp:~d0ugal/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/8655/console
COMMIT: 626bd4a707e99aebfa47f184e6bd001cad794093

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b testtools-monkeypatch lp:~d0ugal/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 3bea79fdd5d3f0f1b8f88e0677f3f16963072bed

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maastesting/__init__.py b/src/maastesting/__init__.py
2index 8d8856c..6133ab5 100644
3--- a/src/maastesting/__init__.py
4+++ b/src/maastesting/__init__.py
5@@ -44,11 +44,3 @@ filterwarnings("ignore", category=DeprecationWarning, module=r"^twisted\b")
6 sentinel_type = type(mock.sentinel.foo)
7 copy._copy_dispatch[sentinel_type] = copy._copy_immutable
8 copy._deepcopy_dispatch[sentinel_type] = copy._copy_immutable
9-
10-# Monkey-patch test dependencies here.
11-from maastesting.twisted import ( # noqa:E402 isort:skip
12- maybe_fix_bug_230_in_CaptureTwistedLogs,
13-)
14-
15-maybe_fix_bug_230_in_CaptureTwistedLogs()
16-del maybe_fix_bug_230_in_CaptureTwistedLogs
17diff --git a/src/maastesting/twisted.py b/src/maastesting/twisted.py
18index 7983106..ef5ae2b 100644
19--- a/src/maastesting/twisted.py
20+++ b/src/maastesting/twisted.py
21@@ -11,12 +11,9 @@ __all__ = [
22 ]
23
24 from copy import copy
25-import inspect
26-from textwrap import dedent
27
28 from fixtures import Fixture
29 from testtools.content import Content, UTF8_TEXT
30-from testtools.deferredruntest import CaptureTwistedLogs
31 from testtools.monkey import patch
32 from testtools.twistedsupport._deferred import extract_result
33 from twisted.internet import defer
34@@ -24,21 +21,6 @@ from twisted.logger import formatEvent, globalLogPublisher, LogLevel
35 from twisted.python import log
36
37
38-def maybe_fix_bug_230_in_CaptureTwistedLogs():
39- """Fix a bug in testtools's `CaptureTwistedLogs`.
40-
41- Specifically "TypeError: CaptureTwistedLogs puts strings into details",
42- https://github.com/testing-cabal/testtools/issues/230. At the time of
43- writing this has been fixed upstream but not released.
44- """
45- source = inspect.getsource(CaptureTwistedLogs._setUp)
46- if "[logs.getvalue()]" in source:
47- source = source.replace("getvalue()", "getvalue().encode('utf-8')")
48- namespace = CaptureTwistedLogs._setUp.__globals__.copy()
49- exec(dedent(source), namespace)
50- CaptureTwistedLogs._setUp = namespace["_setUp"]
51-
52-
53 class TwistedLoggerFixture(Fixture):
54 """Capture all Twisted logging.
55

Subscribers

People subscribed via source and target branches