From d5cb08f660fbb9172a19ce5cae4cf640f1ba07f1 Mon Sep 17 00:00:00 2001 From: Victor Shyba <victor1984@riseup.net> Date: Tue, 21 Nov 2017 16:18:01 -0300 Subject: [PATCH] [bug] remove SOLEDAD_COUCH_URL test env It was None for parallel tests and there is already a mechanism in place for setting this URL, which avoids it being set in two different places. --- .gitlab-ci.yml | 2 -- tests/server/test_tac.py | 15 +++++++-------- tox.ini | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6a76012..2878d78c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,8 +63,6 @@ tests: image: 0xacab.org:4567/leap/soledad:latest services: - couchdb - variables: - SOLEDAD_COUCH_URL: http://couchdb:5984 script: - tox -- --couch-url http://couchdb:5984 diff --git a/tests/server/test_tac.py b/tests/server/test_tac.py index 7f52481c..45bbb142 100644 --- a/tests/server/test_tac.py +++ b/tests/server/test_tac.py @@ -36,6 +36,7 @@ from twisted.web.client import Agent TAC_FILE_PATH = resource_filename('leap.soledad.server', 'server.tac') +@pytest.mark.usefixtures("couch_url") class TacServerTestCase(unittest.TestCase): def test_tac_file_exists(self): @@ -68,14 +69,12 @@ class TacServerTestCase(unittest.TestCase): twistd = os.path.join(path, 'bin', 'twistd') args = [twistd, '--pidfile=', '-noy', TAC_FILE_PATH] - # run Users API on port 2424 without TLS - env = {'DEBUG_SERVER': 'yes'} - - # allow passing of couch url using environment variable, used by gitlab - # ci with docker - couch_url = os.environ.get('SOLEDAD_COUCH_URL') - if couch_url: - env.update({'SOLEDAD_COUCH_URL': couch_url}) + # Use a special environment when running twistd that allow passing of + # couch url using environment variable, used by gitlab ci with docker + env = { + 'DEBUG_SERVER': 'yes', # run Users API on port 2424 without TLS + 'SOLEDAD_COUCH_URL': self.couch_url, # used by gitlab ci + } protocol = ProcessProtocol() proc = reactor.spawnProcess(protocol, twistd, args, env=env) diff --git a/tox.ini b/tox.ini index 00aba168..ca7c11f2 100644 --- a/tox.ini +++ b/tox.ini @@ -42,7 +42,6 @@ setenv = TERM=xterm XDG_CACHE_HOME=./.cache/ CHECK_SQLCIPHER={toxinidir}/scripts/testing/ensure-pysqlcipher-has-usleep.sh -passenv = SOLEDAD_COUCH_URL install_command = pip install {opts} {packages} [testenv:py34] -- GitLab