kopia lustrzana https://github.com/jupyterhub/repo2docker
hg-evolve required for Mercurial support (simpler)
rodzic
39081b70c3
commit
05002a4177
|
@ -106,7 +106,9 @@ jobs:
|
||||||
python setup.py bdist_wheel
|
python setup.py bdist_wheel
|
||||||
pip install dist/*.whl
|
pip install dist/*.whl
|
||||||
pip freeze
|
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"
|
- name: "Run tests"
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -24,8 +24,8 @@ py.test -s tests/<path-to-test>
|
||||||
```
|
```
|
||||||
|
|
||||||
To skip the tests related to Mercurial repositories (to avoid to install
|
To skip the tests related to Mercurial repositories (to avoid to install
|
||||||
Mercurial or hg-evolve), one can use the environment variables
|
Mercurial and hg-evolve), one can use the environment variable
|
||||||
``REPO2DOCKER_SKIP_HG_TESTS`` or ``REPO2DOCKER_SKIP_HG_EVOLVE_TESTS``.
|
``REPO2DOCKER_SKIP_HG_TESTS``.
|
||||||
|
|
||||||
### Troubleshooting Tests
|
### Troubleshooting Tests
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,19 @@ for more details.
|
||||||
Optional: Mercurial
|
Optional: Mercurial
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
For `Mercurial <https://www.mercurial-scm.org>`_ repositories, `Mercurial needs
|
For `Mercurial <https://www.mercurial-scm.org>`_ repositories, Mercurial and
|
||||||
to be installed <https://www.mercurial-scm.org/download>`_. For support of
|
`hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ need to be
|
||||||
`Mercurial topics
|
installed. For example, on Debian based distributions, one can do::
|
||||||
<https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html>`_,
|
|
||||||
also install `hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ which
|
sudo apt install mercurial
|
||||||
provides the topic extension (however, no need to explicitly enable it in a
|
$(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve --user
|
||||||
Mercurial configuration file).
|
|
||||||
|
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``
|
Installing with ``pip``
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
|
@ -10,34 +10,24 @@ from repo2docker.contentproviders import Mercurial
|
||||||
from repo2docker.contentproviders.mercurial import args_enabling_topic
|
from repo2docker.contentproviders.mercurial import args_enabling_topic
|
||||||
|
|
||||||
SKIP_HG = strtobool(os.environ.get("REPO2DOCKER_SKIP_HG_TESTS", "False"))
|
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_if_no_hg_tests = pytest.mark.skipif(
|
||||||
SKIP_HG,
|
SKIP_HG,
|
||||||
reason="REPO2DOCKER_SKIP_HG_TESTS",
|
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
|
@skip_if_no_hg_tests
|
||||||
def test_if_mercurial_is_available():
|
def test_if_mercurial_is_available():
|
||||||
"""
|
"""
|
||||||
To skip the tests related to Mercurial repositories (to avoid to install
|
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.
|
REPO2DOCKER_SKIP_HG_TESTS.
|
||||||
"""
|
"""
|
||||||
subprocess.check_output(["hg", "version"])
|
subprocess.check_output(["hg", "version"])
|
||||||
|
|
||||||
|
|
||||||
@skip_if_no_evolve_tests
|
@skip_if_no_hg_tests
|
||||||
def test_if_topic_is_available():
|
def test_if_topic_is_available():
|
||||||
"""Check that the topic extension can be enabled"""
|
"""Check that the topic extension can be enabled"""
|
||||||
output = subprocess.getoutput("hg version -v --config extensions.topic=")
|
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:
|
with open(Path(repo_dir) / "test", "a") as f:
|
||||||
f.write("Hello")
|
f.write("Hello")
|
||||||
|
|
||||||
subprocess.check_call(["hg", "add", "test"], cwd=repo_dir)
|
def check_call(command):
|
||||||
subprocess.check_call(["hg", "commit", "-m", "Test commit"], cwd=repo_dir)
|
subprocess.check_call(command + args_enabling_topic, cwd=repo_dir)
|
||||||
|
|
||||||
if not SKIP_HG_EVOLVE:
|
check_call(["hg", "add", "test"])
|
||||||
|
check_call(["hg", "commit", "-m", "Test commit"])
|
||||||
def check_call(command):
|
check_call(["hg", "topic", "test-topic"])
|
||||||
subprocess.check_call(command + args_enabling_topic, cwd=repo_dir)
|
check_call(["hg", "commit", "-m", "Test commit in topic test-topic"])
|
||||||
|
check_call(["hg", "up", "default"])
|
||||||
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):
|
def _get_node_id(repo_dir):
|
||||||
|
@ -135,13 +122,13 @@ def test_bad_ref(hg_repo_with_content):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@skip_if_no_evolve_tests
|
@skip_if_no_hg_tests
|
||||||
def test_ref_topic(hg_repo_with_content):
|
def test_ref_topic(hg_repo_with_content):
|
||||||
"""
|
"""
|
||||||
Test trying to update to a topic
|
Test trying to update to a topic
|
||||||
|
|
||||||
To skip this test (to avoid to install hg-evolve), one can use the
|
To skip this test (to avoid to install Mercurial and hg-evolve), one can
|
||||||
environment variable REPO2DOCKER_SKIP_HG_EVOLVE_TESTS.
|
use the environment variable REPO2DOCKER_SKIP_HG_TESTS.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
upstream, node_id = hg_repo_with_content
|
upstream, node_id = hg_repo_with_content
|
||||||
|
|
Ładowanie…
Reference in New Issue