Ensure that venv is used

This is to ensure that the charm doesn't trample on the system packages
for the things that it needs to install, and that it will cooperate with
another reactive charm, especially as it is a subordinate.

Also fix some PEP8 E722 errors as that seems to have been added to the
pep8 standard set.

Change-Id: I9efb78c6f738db2284677dbde85f9e2a3ed0a6fe
This commit is contained in:
Alex Kavanagh 2017-10-26 12:59:42 +01:00
parent a14096c94c
commit 9b0199a547
3 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ interfaces
trusty
.testrepository
__pycache__
.stestr

View File

@ -1,3 +1,6 @@
includes: ['layer:openstack', 'interface:barbican-hsm']
repo: https://github.com/openstack/charm-barbican-softhsm
options:
basic:
use_venv: true
include_system_packages: true

View File

@ -47,8 +47,8 @@ class TestSoftHSM(test_utils.PatchHelper):
# test with no file (patch open so that it raises an error)
mock_open = mock.MagicMock(return_value=mock.sentinel.file_handle)
with mock.patch('builtins.open', mock_open):
def raise_exception():
raise Exception("Supposed to break")
def raise_exception(*args):
raise OSError("Supposed to break")
mock_open.side_effect = raise_exception
pin, so_pin = softhsm.read_pins_from_store()
self.assertEqual(pin, None)