From b740ccbad33bd258390c68bc932373fd25a6d3e7 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 6 Nov 2018 09:52:52 +0100 Subject: [PATCH 1/2] tests: Implement a custom keyring for tests --- Orange/widgets/tests/test_credentials.py | 31 +++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/tests/test_credentials.py b/Orange/widgets/tests/test_credentials.py index 67899a71446..ff61ccd20dc 100644 --- a/Orange/widgets/tests/test_credentials.py +++ b/Orange/widgets/tests/test_credentials.py @@ -1,13 +1,42 @@ import unittest from unittest.mock import patch +import keyring +import keyring.errors +import keyring.backend + from Orange.widgets.credentials import CredentialManager +# minimal in-memory keyring implementation so the test is not dependent on +# the system config/services. +class Keyring(keyring.backend.KeyringBackend): + priority = 0 + + def __init__(self): + self.__store = {} + + def set_password(self, service, username, password=None): + self.__store[(service, username)] = password + + def get_password(self, service, username): + return self.__store.get((service, username), None) + + def delete_password(self, service, username): + try: + del self.__store[service, username] + except KeyError: + raise keyring.errors.PasswordDeleteError() + + class TestCredentialManager(unittest.TestCase): def setUp(self): + self._ring = keyring.get_keyring() + keyring.set_keyring(Keyring()) self.cm = CredentialManager('Orange') - self.cm.key = "Foo" + + def tearDown(self): + keyring.set_keyring(self._ring) def test_credential_manager(self): cm = CredentialManager('Orange') From 4b6fe5d6501c8e1573059d16ae1757a0ce9d2f9a Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 6 Nov 2018 10:11:31 +0100 Subject: [PATCH 2/2] reqirements: Update minumum numpy version to 1.13 Needed since gh-3326 --- requirements-core.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-core.txt b/requirements-core.txt index 307c213fe41..f4a84390643 100644 --- a/requirements-core.txt +++ b/requirements-core.txt @@ -1,5 +1,5 @@ pip>=9.0 -numpy>=1.9.0 +numpy>=1.13.0 scipy>=0.16.1 scikit-learn>=0.18.1 bottleneck>=1.0.0