diff -Nru python-launchpadlib-1.10.12/debian/changelog python-launchpadlib-1.10.13/debian/changelog --- python-launchpadlib-1.10.12/debian/changelog 2020-04-17 09:34:55.000000000 +0000 +++ python-launchpadlib-1.10.13/debian/changelog 2020-04-19 09:35:39.000000000 +0000 @@ -1,3 +1,10 @@ +python-launchpadlib (1.10.13-1) unstable; urgency=medium + + * New upstream release. + - Fix test runs under sudo. + + -- Colin Watson Sun, 19 Apr 2020 10:35:39 +0100 + python-launchpadlib (1.10.12-1) unstable; urgency=medium * New upstream release. diff -Nru python-launchpadlib-1.10.12/NEWS.rst python-launchpadlib-1.10.13/NEWS.rst --- python-launchpadlib-1.10.12/NEWS.rst 2020-04-17 09:30:09.000000000 +0000 +++ python-launchpadlib-1.10.13/NEWS.rst 2020-04-19 09:31:30.000000000 +0000 @@ -2,6 +2,10 @@ NEWS for launchpadlib ===================== +1.10.13 (2020-04-19) +==================== +- Fix test runs under sudo. + 1.10.12 (2020-04-17) ==================== - Postpone keyring.errors import in the same way that we postpone importing diff -Nru python-launchpadlib-1.10.12/PKG-INFO python-launchpadlib-1.10.13/PKG-INFO --- python-launchpadlib-1.10.12/PKG-INFO 2020-04-17 09:30:42.415926200 +0000 +++ python-launchpadlib-1.10.13/PKG-INFO 2020-04-19 09:31:54.523252700 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: launchpadlib -Version: 1.10.12 +Version: 1.10.13 Summary: Script Launchpad through its web services interfaces. Officially supported. Home-page: https://help.launchpad.net/API/launchpadlib Author: The Launchpad developers @@ -34,6 +34,10 @@ NEWS for launchpadlib ===================== + 1.10.13 (2020-04-19) + ==================== + - Fix test runs under sudo. + 1.10.12 (2020-04-17) ==================== - Postpone keyring.errors import in the same way that we postpone importing @@ -380,3 +384,4 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Provides-Extra: docs +Provides-Extra: test diff -Nru python-launchpadlib-1.10.12/setup.py python-launchpadlib-1.10.13/setup.py --- python-launchpadlib-1.10.12/setup.py 2020-02-04 14:35:52.000000000 +0000 +++ python-launchpadlib-1.10.13/setup.py 2020-04-19 09:29:30.000000000 +0000 @@ -88,6 +88,9 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", ], - extras_require={'docs': ['Sphinx']}, + extras_require={ + 'docs': ['Sphinx'], + 'test': ['mock; python_version < "3"'], + }, test_suite='launchpadlib.tests', ) diff -Nru python-launchpadlib-1.10.12/src/launchpadlib/docs/NEWS.rst python-launchpadlib-1.10.13/src/launchpadlib/docs/NEWS.rst --- python-launchpadlib-1.10.12/src/launchpadlib/docs/NEWS.rst 2020-04-17 09:30:09.000000000 +0000 +++ python-launchpadlib-1.10.13/src/launchpadlib/docs/NEWS.rst 2020-04-19 09:31:30.000000000 +0000 @@ -2,6 +2,10 @@ NEWS for launchpadlib ===================== +1.10.13 (2020-04-19) +==================== +- Fix test runs under sudo. + 1.10.12 (2020-04-17) ==================== - Postpone keyring.errors import in the same way that we postpone importing diff -Nru python-launchpadlib-1.10.12/src/launchpadlib/tests/test_launchpad.py python-launchpadlib-1.10.13/src/launchpadlib/tests/test_launchpad.py --- python-launchpadlib-1.10.12/src/launchpadlib/tests/test_launchpad.py 2020-04-08 15:34:03.000000000 +0000 +++ python-launchpadlib-1.10.13/src/launchpadlib/tests/test_launchpad.py 2020-04-19 09:29:30.000000000 +0000 @@ -25,6 +25,10 @@ import stat import tempfile import unittest +try: + from unittest.mock import patch +except ImportError: + from mock import patch import warnings from lazr.restfulclient.resource import ServiceRoot @@ -612,6 +616,7 @@ launchpadlib.launchpad.socket = socket shutil.rmtree(self.temp_dir) + @patch.object(NoNetworkLaunchpad, '_is_sudo', staticmethod(lambda: False)) def test_credentials_save_failed(self): # If saving the credentials did not succeed and a callback was # provided, it is called. @@ -631,6 +636,7 @@ credential_save_failed=callback) self.assertEqual(len(callback_called), 1) + @patch.object(NoNetworkLaunchpad, '_is_sudo', staticmethod(lambda: False)) def test_default_credentials_save_failed_is_to_raise_exception(self): # If saving the credentials did not succeed and no callback was # provided, the underlying exception is raised. @@ -643,6 +649,17 @@ 'not important', service_root=service_root, launchpadlib_dir=launchpadlib_dir) + @patch.object(NoNetworkLaunchpad, '_is_sudo', staticmethod(lambda: True)) + def test_credentials_save_fail_under_sudo_does_not_raise_exception(self): + # When running under sudo, Launchpad will not attempt to use + # the keyring, so credential save failure will never happen + launchpadlib_dir = os.path.join(self.temp_dir, 'launchpadlib') + service_root = "http://api.example.com/" + with fake_keyring(BadSaveKeyring()): + NoNetworkLaunchpad.login_with( + 'not important', service_root=service_root, + launchpadlib_dir=launchpadlib_dir) + class TestMultipleSites(unittest.TestCase): # If the same application name (consumer name) is used to access more than @@ -660,6 +677,7 @@ launchpadlib.launchpad.socket = socket shutil.rmtree(self.temp_dir) + @patch.object(NoNetworkLaunchpad, '_is_sudo', staticmethod(lambda: False)) def test_components_of_application_key(self): launchpadlib_dir = os.path.join(self.temp_dir, 'launchpadlib') keyring = InMemoryKeyring() @@ -684,6 +702,7 @@ # "forgotten"). self.assertEqual(application_key, consumer_name + '@' + service_root) + @patch.object(NoNetworkLaunchpad, '_is_sudo', staticmethod(lambda: False)) def test_same_app_different_servers(self): launchpadlib_dir = os.path.join(self.temp_dir, 'launchpadlib') keyring = InMemoryKeyring() diff -Nru python-launchpadlib-1.10.12/src/launchpadlib/version.txt python-launchpadlib-1.10.13/src/launchpadlib/version.txt --- python-launchpadlib-1.10.12/src/launchpadlib/version.txt 2020-04-17 09:30:18.000000000 +0000 +++ python-launchpadlib-1.10.13/src/launchpadlib/version.txt 2020-04-19 09:31:34.000000000 +0000 @@ -1 +1 @@ -1.10.12 +1.10.13 diff -Nru python-launchpadlib-1.10.12/src/launchpadlib.egg-info/PKG-INFO python-launchpadlib-1.10.13/src/launchpadlib.egg-info/PKG-INFO --- python-launchpadlib-1.10.12/src/launchpadlib.egg-info/PKG-INFO 2020-04-17 09:30:40.000000000 +0000 +++ python-launchpadlib-1.10.13/src/launchpadlib.egg-info/PKG-INFO 2020-04-19 09:31:52.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: launchpadlib -Version: 1.10.12 +Version: 1.10.13 Summary: Script Launchpad through its web services interfaces. Officially supported. Home-page: https://help.launchpad.net/API/launchpadlib Author: The Launchpad developers @@ -34,6 +34,10 @@ NEWS for launchpadlib ===================== + 1.10.13 (2020-04-19) + ==================== + - Fix test runs under sudo. + 1.10.12 (2020-04-17) ==================== - Postpone keyring.errors import in the same way that we postpone importing @@ -380,3 +384,4 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Provides-Extra: docs +Provides-Extra: test diff -Nru python-launchpadlib-1.10.12/src/launchpadlib.egg-info/requires.txt python-launchpadlib-1.10.13/src/launchpadlib.egg-info/requires.txt --- python-launchpadlib-1.10.12/src/launchpadlib.egg-info/requires.txt 2020-04-17 09:30:40.000000000 +0000 +++ python-launchpadlib-1.10.13/src/launchpadlib.egg-info/requires.txt 2020-04-19 09:31:52.000000000 +0000 @@ -9,3 +9,8 @@ [docs] Sphinx + +[test] + +[test:python_version < "3"] +mock