diff options
author | drebs <drebs@riseup.net> | 2017-08-30 14:56:34 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-08-31 10:48:17 -0300 |
commit | dff0dd3331b979e013e63d52d8e6ab285df3094b (patch) | |
tree | 2cf757c008036eb81ac8ce1aee004966e91c72ea | |
parent | 5c2a612aec7919c4935d3dcdf666642beaa74379 (diff) |
[test] pass config file in environment variable
-rw-r--r-- | testing/tests/conftest.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 77f46426..817a43b0 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -131,14 +131,27 @@ class SoledadServer(object): ]) def _create_conf_file(self): + + # come up with name of the configuration file + fname = '/etc/soledad/soledad-server.conf' if not os.access('/etc', os.W_OK): - return - if not os.path.isdir('/etc/soledad'): - os.mkdir('/etc/soledad') - with open('/etc/soledad/soledad-server.conf', 'w') as f: - content = '[soledad-server]\ncouch_url = %s' % self._couch_url + fname = os.path.join(self.tmpdir.strpath, 'soledad-server.conf') + + # create the configuration file + dirname = os.path.dirname(fname) + if not os.path.isdir(dirname): + os.mkdir(dirname) + with open(fname, 'w') as f: + blobs_path = os.path.join(str(self.tmpdir), 'blobs') + content = '''[soledad-server] +couch_url = %s +blobs = true +blobs_path = %s''' % (self._couch_url, blobs_path) f.write(content) + # update the environment to use that file + os.environ.update({'SOLEDAD_SERVER_CONFIG_FILE': fname}) + def stop(self): pid = get_pid(self._pidfile) os.kill(pid, signal.SIGTERM) |