diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03cdd275785af53922dc1264257c36129ce8178a_LmdpdGxhYi1jaS55bWw=..7132b76bbb5d9615ae52480f8424f1d300146398_LmdpdGxhYi1jaS55bWw= 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,6 @@ stage: test image: octobus/ci-py2-hgext3rd:hg-5.2 script: - - make -C /ci/repos/mercurial local - PYTHONPATH=/ci/repos/mercurial python -c "from mercurial import util; print(util.version())" - PYTHONPATH=/ci/repos/mercurial ~/.local/bin/py.test --cov heptapod --cov hgext3rd.heptapod diff --git a/heptapod/hooks/tests/test_check_publish.py b/heptapod/hooks/tests/test_check_publish.py index 03cdd275785af53922dc1264257c36129ce8178a_aGVwdGFwb2QvaG9va3MvdGVzdHMvdGVzdF9jaGVja19wdWJsaXNoLnB5..7132b76bbb5d9615ae52480f8424f1d300146398_aGVwdGFwb2QvaG9va3MvdGVzdHMvdGVzdF9jaGVja19wdWJsaXNoLnB5 100644 --- a/heptapod/hooks/tests/test_check_publish.py +++ b/heptapod/hooks/tests/test_check_publish.py @@ -8,6 +8,8 @@ LocalRepoWrapper, ) +from .utils import switch_user + def init_repo(basedir): return LocalRepoWrapper.init( @@ -23,10 +25,6 @@ )) -def switch_user(wrapper, user): - wrapper.repo.ui.environ['REMOTE_USER'] = user - - def test_draft_publish(tmpdir): wrapper = init_repo(tmpdir) switch_user(wrapper, 'someone') diff --git a/heptapod/hooks/tests/utils.py b/heptapod/hooks/tests/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..7132b76bbb5d9615ae52480f8424f1d300146398_aGVwdGFwb2QvaG9va3MvdGVzdHMvdXRpbHMucHk= --- /dev/null +++ b/heptapod/hooks/tests/utils.py @@ -0,0 +1,7 @@ +def switch_user(wrapper, user): + """Common method to change the name of the acting user. + + This helps enforcing that it works uniformly for all permission + related hooks. + """ + wrapper.repo.ui.environ['REMOTE_USER'] = user diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000000000000000000000000000000000..7132b76bbb5d9615ae52480f8424f1d300146398_cHl0ZXN0LmluaQ== --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +adopts = --doctest-modules