Skip to content
Snippets Groups Projects
Commit 09352483f03f authored by Georges Racinet's avatar Georges Racinet
Browse files

wsgi: instanciating HgServe only if environ var is present

This depends onto heptapod-docker!5, which sets said environment
variable.

This still allows us to run in a gunicorn one-liner without any
further wrapper, while being less hardcoded and unit-testable, as
the first test demonstrates.

It would be even nicer to instantiate `HgServe` without
any configuration file (relying e.g. on baseui to pass configuration),
this could be done later.
parent b7ea45e7b35f
No related branches found
No related tags found
No related merge requests found
import pytest
from ..wsgi import HgServe
def test_missing_repositories_root(tmpdir):
hgrc_path = tmpdir.join('heptapod.hgrc')
hgrc_path.write('\n'.join(("[extensions]", "evolve=", "topic=", "")))
with pytest.raises(ValueError) as exc_info:
HgServe(str(hgrc_path))
assert 'heptapod.repositories-root' in exc_info.value.args[0]
......@@ -181,4 +181,6 @@
return res.sendresponse()
hgserve = HgServe("/etc/gitlab/heptapod.hgrc")
HEPTAPOD_HGRC = os.environ.get('HEPTAPOD_HGRC')
if HEPTAPOD_HGRC:
hgserve = HgServe("/etc/gitlab/heptapod.hgrc")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment