hg-evolve required for Mercurial support (simpler)

pull/950/head
paugier 2020-09-14 14:05:52 +02:00
rodzic 39081b70c3
commit 05002a4177
4 zmienionych plików z 30 dodań i 35 usunięć

Wyświetl plik

@ -106,7 +106,9 @@ jobs:
python setup.py bdist_wheel
pip install dist/*.whl
pip freeze
pip install mercurial hg-evolve
# hg-evolve pinned to 9.2 because hg-evolve dropped support for
# hg 4.5, installed with apt in Ubuntu 18.04
$(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve==9.2 --user
- name: "Run tests"
run: |

Wyświetl plik

@ -24,8 +24,8 @@ py.test -s tests/<path-to-test>
```
To skip the tests related to Mercurial repositories (to avoid to install
Mercurial or hg-evolve), one can use the environment variables
``REPO2DOCKER_SKIP_HG_TESTS`` or ``REPO2DOCKER_SKIP_HG_EVOLVE_TESTS``.
Mercurial and hg-evolve), one can use the environment variable
``REPO2DOCKER_SKIP_HG_TESTS``.
### Troubleshooting Tests

Wyświetl plik

@ -25,13 +25,19 @@ for more details.
Optional: Mercurial
-------------------
For `Mercurial <https://www.mercurial-scm.org>`_ repositories, `Mercurial needs
to be installed <https://www.mercurial-scm.org/download>`_. For support of
`Mercurial topics
<https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html>`_,
also install `hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ which
provides the topic extension (however, no need to explicitly enable it in a
Mercurial configuration file).
For `Mercurial <https://www.mercurial-scm.org>`_ repositories, Mercurial and
`hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ need to be
installed. For example, on Debian based distributions, one can do::
sudo apt install mercurial
$(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve --user
To install Mercurial on other systems, see `here
<https://www.mercurial-scm.org/download>`_.
Note that for old Mercurial versions, you may need to specify a version for
hg-evolve. For example, ``hg-evolve==9.2`` for hg 4.5 (which is installed with
`apt` on Ubuntu 18.4).
Installing with ``pip``
-----------------------

Wyświetl plik

@ -10,34 +10,24 @@ from repo2docker.contentproviders import Mercurial
from repo2docker.contentproviders.mercurial import args_enabling_topic
SKIP_HG = strtobool(os.environ.get("REPO2DOCKER_SKIP_HG_TESTS", "False"))
SKIP_HG_EVOLVE = SKIP_HG or strtobool(
os.environ.get("REPO2DOCKER_SKIP_HG_EVOLVE_TESTS", "False")
)
skip_if_no_hg_tests = pytest.mark.skipif(
SKIP_HG,
reason="REPO2DOCKER_SKIP_HG_TESTS",
)
skip_if_no_evolve_tests = pytest.mark.skipif(
SKIP_HG_EVOLVE,
reason="REPO2DOCKER_SKIP_HG_EVOLVE_TESTS",
)
if SKIP_HG_EVOLVE:
args_enabling_topic = []
@skip_if_no_hg_tests
def test_if_mercurial_is_available():
"""
To skip the tests related to Mercurial repositories (to avoid to install
Mercurial), one can use the environment variable
Mercurial and hg-evolve), one can use the environment variable
REPO2DOCKER_SKIP_HG_TESTS.
"""
subprocess.check_output(["hg", "version"])
@skip_if_no_evolve_tests
@skip_if_no_hg_tests
def test_if_topic_is_available():
"""Check that the topic extension can be enabled"""
output = subprocess.getoutput("hg version -v --config extensions.topic=")
@ -50,17 +40,14 @@ def _add_content_to_hg(repo_dir):
with open(Path(repo_dir) / "test", "a") as f:
f.write("Hello")
subprocess.check_call(["hg", "add", "test"], cwd=repo_dir)
subprocess.check_call(["hg", "commit", "-m", "Test commit"], cwd=repo_dir)
def check_call(command):
subprocess.check_call(command + args_enabling_topic, cwd=repo_dir)
if not SKIP_HG_EVOLVE:
def check_call(command):
subprocess.check_call(command + args_enabling_topic, cwd=repo_dir)
check_call(["hg", "topic", "test-topic"])
check_call(["hg", "commit", "-m", "Test commit in topic test-topic"])
check_call(["hg", "up", "default"])
check_call(["hg", "add", "test"])
check_call(["hg", "commit", "-m", "Test commit"])
check_call(["hg", "topic", "test-topic"])
check_call(["hg", "commit", "-m", "Test commit in topic test-topic"])
check_call(["hg", "up", "default"])
def _get_node_id(repo_dir):
@ -135,13 +122,13 @@ def test_bad_ref(hg_repo_with_content):
pass
@skip_if_no_evolve_tests
@skip_if_no_hg_tests
def test_ref_topic(hg_repo_with_content):
"""
Test trying to update to a topic
To skip this test (to avoid to install hg-evolve), one can use the
environment variable REPO2DOCKER_SKIP_HG_EVOLVE_TESTS.
To skip this test (to avoid to install Mercurial and hg-evolve), one can
use the environment variable REPO2DOCKER_SKIP_HG_TESTS.
"""
upstream, node_id = hg_repo_with_content