From ea56ded7fceedf708318d6983bfabe1e66d979cd Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 10 Jan 2017 14:14:03 +0100 Subject: [PATCH] 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... --- tests/unit/utils/test_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index a765cd977..ef677f120 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -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