fix TestOpenFile

pytest doesn't like test classes which define __init__, and pylint
doesn't like attributes defined outside __init__.

We can disable pylint's check, but we can't force pytest to accept our
test class...
This commit is contained in:
Daniel Schadt 2017-01-10 14:14:03 +01:00
parent bb135a00e6
commit ea56ded7fc

View File

@ -989,9 +989,6 @@ def test_random_port():
class TestOpenFile:
def __init__(self):
self.open_url_called = False
def test_cmdline_without_argument(self, caplog, config_stub):
config_stub.data = {'general': {'default-open-dispatcher': ''}}
cmdline = '{} -c pass'.format(sys.executable)
@ -1018,6 +1015,8 @@ class TestOpenFile:
def test_system_default_application(self, caplog, config_stub,
monkeypatch):
# pylint: disable=attribute-defined-outside-init
self.open_url_called = False
config_stub.data = {'general': {'default-open-dispatcher': ''}}
monkeypatch.setattr('PyQt5.QtGui.QDesktopServices.openUrl',
self.mock_open_url)
@ -1028,4 +1027,5 @@ class TestOpenFile:
assert self.open_url_called
def mock_open_url(self, url):
# pylint: disable=attribute-defined-outside-init
self.open_url_called = True