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:
parent
bb135a00e6
commit
ea56ded7fc
@ -989,9 +989,6 @@ def test_random_port():
|
|||||||
|
|
||||||
class TestOpenFile:
|
class TestOpenFile:
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.open_url_called = False
|
|
||||||
|
|
||||||
def test_cmdline_without_argument(self, caplog, config_stub):
|
def test_cmdline_without_argument(self, caplog, config_stub):
|
||||||
config_stub.data = {'general': {'default-open-dispatcher': ''}}
|
config_stub.data = {'general': {'default-open-dispatcher': ''}}
|
||||||
cmdline = '{} -c pass'.format(sys.executable)
|
cmdline = '{} -c pass'.format(sys.executable)
|
||||||
@ -1018,6 +1015,8 @@ class TestOpenFile:
|
|||||||
|
|
||||||
def test_system_default_application(self, caplog, config_stub,
|
def test_system_default_application(self, caplog, config_stub,
|
||||||
monkeypatch):
|
monkeypatch):
|
||||||
|
# pylint: disable=attribute-defined-outside-init
|
||||||
|
self.open_url_called = False
|
||||||
config_stub.data = {'general': {'default-open-dispatcher': ''}}
|
config_stub.data = {'general': {'default-open-dispatcher': ''}}
|
||||||
monkeypatch.setattr('PyQt5.QtGui.QDesktopServices.openUrl',
|
monkeypatch.setattr('PyQt5.QtGui.QDesktopServices.openUrl',
|
||||||
self.mock_open_url)
|
self.mock_open_url)
|
||||||
@ -1028,4 +1027,5 @@ class TestOpenFile:
|
|||||||
assert self.open_url_called
|
assert self.open_url_called
|
||||||
|
|
||||||
def mock_open_url(self, url):
|
def mock_open_url(self, url):
|
||||||
|
# pylint: disable=attribute-defined-outside-init
|
||||||
self.open_url_called = True
|
self.open_url_called = True
|
||||||
|
Loading…
Reference in New Issue
Block a user