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
diff --git a/gpgservice_client/testing/_fixture.py b/gpgservice_client/testing/_fixture.py
index e447432..8a9a5ad 100644
--- a/gpgservice_client/testing/_fixture.py
+++ b/gpgservice_client/testing/_fixture.py
@@ -26,7 +26,8 @@ class GPGKeyServiceFixture(Fixture):
26 """Run the gpgservice webapp and test key server."""26 """Run the gpgservice webapp and test key server."""
2727
28 def __init__(self, keyserver_host=None, keyserver_port=None,28 def __init__(self, keyserver_host=None, keyserver_port=None,
29 gunicorn_path=None, service_start_timeout=5.0):29 gunicorn_path=None, service_start_timeout=5.0,
30 gpgservice_root=None):
30 """Create a new GPGKeyServiceFixture.31 """Create a new GPGKeyServiceFixture.
3132
32 :param config_fixture: If specified, this must be a ConfigFixture33 :param config_fixture: If specified, this must be a ConfigFixture
@@ -37,12 +38,16 @@ class GPGKeyServiceFixture(Fixture):
37 :param gunicorn_path: Path to gunicorn binary.38 :param gunicorn_path: Path to gunicorn binary.
38 :param service_start_timeout: The maximum time (in seconds) to wait39 :param service_start_timeout: The maximum time (in seconds) to wait
39 for the gpgservice instance to start responding to HTTP queries.40 for the gpgservice instance to start responding to HTTP queries.
41 :param gpgservice_root: The path to the gpgservice python package. If
42 specified, it will be added to the PYTHONPATH of the spawned
43 process.
40 """44 """
4145
42 self.keyserver_host = keyserver_host46 self.keyserver_host = keyserver_host
43 self.keyserver_port = keyserver_port47 self.keyserver_port = keyserver_port
44 self.gunicorn_path = gunicorn_path48 self.gunicorn_path = gunicorn_path
45 self.service_start_timeout = service_start_timeout49 self.service_start_timeout = service_start_timeout
50 self.gpgservice_root = gpgservice_root
4651
47 def setUp(self):52 def setUp(self):
48 super(GPGKeyServiceFixture, self).setUp()53 super(GPGKeyServiceFixture, self).setUp()
@@ -59,6 +64,8 @@ class GPGKeyServiceFixture(Fixture):
59 # config file from:64 # config file from:
60 env = os.environ.copy()65 env = os.environ.copy()
61 env['GPGSERVICE_CONFIG_PATH'] = self._config_file.name66 env['GPGSERVICE_CONFIG_PATH'] = self._config_file.name
67 if self.gpgservice_root:
68 env['PYTHONPATH'] = self.gpgservice_root
6269
63 if self.gunicorn_path is None:70 if self.gunicorn_path is None:
64 self.gunicorn_path = os.path.join('env', 'bin', 'gunicorn')71 self.gunicorn_path = os.path.join('env', 'bin', 'gunicorn')

Subscribers

People subscribed via source and target branches

to all changes: