From dff0dd3331b979e013e63d52d8e6ab285df3094b Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 30 Aug 2017 14:56:34 -0300 Subject: [test] pass config file in environment variable --- testing/tests/conftest.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'testing/tests') 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) -- cgit v1.2.3