diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-02-01 22:17:15 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-02-01 22:17:15 +0100 |
commit | c70ad5009daefa90b17f93fe0d66d48cef66113a (patch) | |
tree | 3b5cfe61b641c3df7e12c3cd8984a7a6d15050a1 | |
parent | 0169372ad1782281dc7af802aa5806135947399b (diff) | |
download | gemato-c70ad5009daefa90b17f93fe0d66d48cef66113a.tar.gz |
openpgp: Use assertion for home-after-close()
-rw-r--r-- | gemato/openpgp.py | 4 | ||||
-rw-r--r-- | tests/test_openpgp.py | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index c27eef4..9d10d33 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -228,9 +228,7 @@ disable-scdaemon @property def home(self): - if self._home is None: - raise RuntimeError( - 'OpenPGPEnvironment has been closed') + assert self._home is not None return self._home def _spawn_gpg(self, options, stdin): diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index bbb6a8e..981f550 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -791,7 +791,7 @@ class OpenPGPContextManagerTest(unittest.TestCase): def test_home_after_close(self): with gemato.openpgp.OpenPGPEnvironment() as env: env.close() - with self.assertRaises(RuntimeError): + with self.assertRaises(AssertionError): env.home |