From 2d2e9bf19ad0dd11c5c545a62eb090e704362e69 Mon Sep 17 00:00:00 2001 From: paugier Date: Mon, 7 Sep 2020 09:38:07 +0200 Subject: [PATCH] Skip Mercurial for Python 3.5 --- Pipfile | 4 ++-- dev-requirements.txt | 4 ++-- tests/unit/contentproviders/test_mercurial.py | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Pipfile b/Pipfile index 3aa175da..afc8bcd2 100644 --- a/Pipfile +++ b/Pipfile @@ -12,8 +12,8 @@ alabaster = "*" Sphinx = ">=1.4,!=1.5.4" alabaster_jupyterhub = "*" sphinxcontrib-autoprogram = "*" -mercurial = "*" -hg-evolve = "*" +mercurial = {version = ">=5.2", markers="python_version > '3.5'"} +hg-evolve = {version = ">=10.0", markers="python_version > '3.5'"} [packages] repo2docker = {path=".", editable=true} diff --git a/dev-requirements.txt b/dev-requirements.txt index 288c0e5d..1105d9aa 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,5 +6,5 @@ wheel pytest-cov pre-commit requests -mercurial -hg-evolve +mercurial>=5.2; python_version > '3.5' +hg-evolve>=10.0; python_version > '3.5' diff --git a/tests/unit/contentproviders/test_mercurial.py b/tests/unit/contentproviders/test_mercurial.py index 5cfcd482..dee5b510 100644 --- a/tests/unit/contentproviders/test_mercurial.py +++ b/tests/unit/contentproviders/test_mercurial.py @@ -1,12 +1,18 @@ from pathlib import Path import subprocess from tempfile import TemporaryDirectory +import sys import pytest from repo2docker.contentproviders import Mercurial +skipif_py35 = pytest.mark.skipif( + sys.version_info < (3, 6), reason="requires python3.6" +) + + def _add_content_to_hg(repo_dir): """Add content to file 'test' in hg repository and commit.""" # use append mode so this can be called multiple times @@ -19,7 +25,9 @@ def _add_content_to_hg(repo_dir): def _get_sha1(repo_dir): """Get repository's current commit SHA1.""" - sha1 = subprocess.Popen(["hg", "identify"], stdout=subprocess.PIPE, cwd=repo_dir) + sha1 = subprocess.Popen( + ["hg", "identify"], stdout=subprocess.PIPE, cwd=repo_dir + ) return sha1.stdout.read().decode().strip() @@ -44,6 +52,7 @@ def hg_repo_with_content(hg_repo): yield hg_repo, sha1 +@skipif_py35 def test_detect_mercurial(hg_repo_with_content, repo_with_content): mercurial = Mercurial() assert mercurial.detect("this-is-not-a-directory") is None @@ -56,6 +65,7 @@ def test_detect_mercurial(hg_repo_with_content, repo_with_content): assert mercurial.detect(hg_repo) == {"repo": hg_repo, "ref": None} +@skipif_py35 def test_clone(hg_repo_with_content): """Test simple hg clone to a target dir""" upstream, sha1 = hg_repo_with_content @@ -70,6 +80,7 @@ def test_clone(hg_repo_with_content): assert mercurial.content_id == sha1[:7] +@skipif_py35 def test_bad_ref(hg_repo_with_content): """ Test trying to checkout a ref that doesn't exist