Merge gpgservice-client:add-pythonpath-hack into gpgservice-client:master

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 13c6e413e633838e945383916b336e1c04f169ee
Merged at revision: 13c6e413e633838e945383916b336e1c04f169ee
Proposed branch: gpgservice-client:add-pythonpath-hack
Merge into: gpgservice-client:master
Diff against target: 40 lines (+8/-1)
1 file modified
gpgservice_client/testing/_fixture.py (+8/-1)
Reviewer Review Type Date Requested Status
Kit Randel (community) Approve
Review via email: mp+298594@code.launchpad.net

Commit message

Allow GPGServiceFixture to work when gpgservice is not in sys.path.

Description of the change

Add an option to set a custom PYTHONPATH, for when the gpgservice python package isn't in the current working directory, or installed to the virtualenv.

To post a comment you must log in.
Revision history for this message
Kit Randel (blr) wrote :

lgtm, despite your gremlins.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gpgservice_client/testing/_fixture.py b/gpgservice_client/testing/_fixture.py
2index e447432..8a9a5ad 100644
3--- a/gpgservice_client/testing/_fixture.py
4+++ b/gpgservice_client/testing/_fixture.py
5@@ -26,7 +26,8 @@ class GPGKeyServiceFixture(Fixture):
6 """Run the gpgservice webapp and test key server."""
7
8 def __init__(self, keyserver_host=None, keyserver_port=None,
9- gunicorn_path=None, service_start_timeout=5.0):
10+ gunicorn_path=None, service_start_timeout=5.0,
11+ gpgservice_root=None):
12 """Create a new GPGKeyServiceFixture.
13
14 :param config_fixture: If specified, this must be a ConfigFixture
15@@ -37,12 +38,16 @@ class GPGKeyServiceFixture(Fixture):
16 :param gunicorn_path: Path to gunicorn binary.
17 :param service_start_timeout: The maximum time (in seconds) to wait
18 for the gpgservice instance to start responding to HTTP queries.
19+ :param gpgservice_root: The path to the gpgservice python package. If
20+ specified, it will be added to the PYTHONPATH of the spawned
21+ process.
22 """
23
24 self.keyserver_host = keyserver_host
25 self.keyserver_port = keyserver_port
26 self.gunicorn_path = gunicorn_path
27 self.service_start_timeout = service_start_timeout
28+ self.gpgservice_root = gpgservice_root
29
30 def setUp(self):
31 super(GPGKeyServiceFixture, self).setUp()
32@@ -59,6 +64,8 @@ class GPGKeyServiceFixture(Fixture):
33 # config file from:
34 env = os.environ.copy()
35 env['GPGSERVICE_CONFIG_PATH'] = self._config_file.name
36+ if self.gpgservice_root:
37+ env['PYTHONPATH'] = self.gpgservice_root
38
39 if self.gunicorn_path is None:
40 self.gunicorn_path = os.path.join('env', 'bin', 'gunicorn')

Subscribers

People subscribed via source and target branches

to all changes: