use skipIf decorator, not inline logic

This commit is contained in:
meejah 2018-08-24 16:51:47 -06:00
parent d478cf3831
commit 38dac24b2b

View File

@ -5,6 +5,7 @@ import sys
import time
import mock
from unittest import skipIf
from twisted.trial import unittest
from twisted.internet import defer
@ -147,15 +148,14 @@ class TestCase(testutil.SignalMixin, unittest.TestCase):
with self.assertRaises(Exception):
config.get_config_from_file("it_does_not_exist", required=True)
@skipIf(
"win32" in sys.platform.lower() or "cygwin" in sys.platform.lower(),
"We don't know how to set permissions on Windows.",
)
def test_private_config_unreadable(self):
"""
Asking for inaccessible private config is an error
"""
if "win32" in sys.platform.lower() or "cygwin" in sys.platform.lower():
# We don't know how to test that unprivileged users can't read this
# thing. (Also we don't know exactly how to set the permissions so
# that unprivileged users can't read this thing.)
raise unittest.SkipTest("We don't know how to set permissions on Windows.")
basedir = u"test_node/test_private_config_unreadable"
create_node_dir(basedir, "testing")
config = read_config(basedir, "portnum")