Stop mocking safe_load

The comment implies this will cause something to break on some platform.
Let's find out.
This commit is contained in:
Jean-Paul Calderone 2020-12-16 15:24:33 -05:00
parent d19b1cfd68
commit 83ebaef86c

View File

@ -15,7 +15,7 @@ from six import ensure_binary, ensure_text
import os, re, itertools import os, re, itertools
from base64 import b32decode from base64 import b32decode
import json import json
from mock import Mock, patch from mock import Mock
from testtools.matchers import ( from testtools.matchers import (
Is, Is,
@ -94,17 +94,10 @@ class Node(testutil.SignalMixin, testutil.ReallyEqualMixin, AsyncTestCase):
f.write(u'---\n') f.write(u'---\n')
os.chmod(yaml_fname, 0o000) os.chmod(yaml_fname, 0o000)
self.addCleanup(lambda: os.chmod(yaml_fname, 0o700)) self.addCleanup(lambda: os.chmod(yaml_fname, 0o700))
# just mocking the yaml failure, as "yamlutil.safe_load" only
# returns None on some platforms for unreadable files
with patch("allmydata.client.yamlutil") as p:
p.safe_load = Mock(return_value=None)
fake_tub = Mock()
config = read_config(basedir, "portnum") config = read_config(basedir, "portnum")
with self.assertRaises(EnvironmentError): with self.assertRaises(EnvironmentError):
create_introducer_clients(config, fake_tub) create_introducer_clients(config, Tub())
@defer.inlineCallbacks @defer.inlineCallbacks
def test_furl(self): def test_furl(self):