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

pull_force_topic: removed accidentally duplicated test module

All the remaing tests are in test_pull_force_topic and
identical alreay.
parent 06dcf5cf
No related branches found
No related tags found
No related merge requests found
from __future__ import absolute_import
import pytest
from mercurial import (
error,
)
from heptapod.testhelpers import (
LocalRepoWrapper,
make_ui,
)
from .. import (
change_topic,
cleanup_tmp_bundle,
)
from .utils import common_config
def make_main_repo(path):
"""Make repo with 2 public revs; return wrapper, ctx of rev 0
The returned ctx is for the first changeset because we'll use it as
a branching point, hence more often than the second.
"""
config = common_config()
config['phases'] = dict(publish=False)
wrapper = LocalRepoWrapper.init(path, config=config)
ctx = wrapper.write_commit('foo', content='foo0', message="default0",
return_ctx=True)
wrapper.write_commit('foo', content='foo1', message="default1")
wrapper.set_phase('public', ['.'])
return wrapper, ctx
def test_change_topic_sanity(tmpdir):
wrapper, base_ctx = make_main_repo(tmpdir)
repo = wrapper.repo
# early validation:
with pytest.raises(error.Abort) as exc_info:
wrapper.command('pull-force-topic', ' ')
assert 'entirely of whitespace' in exc_info.value.args[0]
with pytest.raises(error.Abort) as exc_info:
wrapper.command('pull-force-topic', 'tip')
assert 'reserved' in exc_info.value.args[0]
# inner check done in transaction
with pytest.raises(error.Abort) as exc_info:
change_topic(repo.ui, repo, 'sometopic', [base_ctx.node()])
assert 'public' in exc_info.value.args[0]
def test_cleanup_tmp_bundle_exc(tmpdir):
ui = make_ui(None)
path = tmpdir.join('bundle')
# no file at given path
cleanup_tmp_bundle(ui, None, str(path))
path.write('foo')
# close fails (of course, fobj is None)
cleanup_tmp_bundle(ui, None, str(path))
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