From 2186caf11d953e9183b30be0646995f1ab45e684 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 22 Dec 2021 08:14:00 +0000 Subject: [PATCH] Speed up CI tests on macOS (#3480) --- .github/workflows/ci.yml | 4 ++++ tests/test_bare.sh | 7 ------- tests/test_cookiecutter_generation.py | 8 +++++--- tests/test_docker.sh | 3 --- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 238062e1..31c6fae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,8 @@ jobs: with: python-version: "3.9" cache: pip + - name: Install dependencies + run: pip install -r requirements.txt - name: Docker ${{ matrix.script.name }} run: sh tests/test_docker.sh ${{ matrix.script.args }} @@ -99,6 +101,8 @@ jobs: python-version: "3.9" cache: pip cache-dependency-path: '**/requirements*.txt' + - name: Install dependencies + run: pip install -r requirements.txt - uses: actions/setup-node@v2 with: node-version: "16" diff --git a/tests/test_bare.sh b/tests/test_bare.sh index 53162f91..c3842bd9 100755 --- a/tests/test_bare.sh +++ b/tests/test_bare.sh @@ -6,13 +6,6 @@ set -o errexit set -x -# Install modern pip with new resolver: -# https://blog.python.org/2020/11/pip-20-3-release-new-resolver.html -pip install 'pip>=20.3' - -# install test requirements -pip install -r requirements.txt - # create a cache directory mkdir -p .cache/bare cd .cache/bare diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 56ae4a64..49a0d2cc 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -14,7 +14,11 @@ from cookiecutter.exceptions import FailedHookException PATTERN = r"{{(\s?cookiecutter)[.](.*?)}}" RE_OBJ = re.compile(PATTERN) -IS_WINDOWS = sys.platform.startswith("win") + +if sys.platform.startswith("win"): + pytest.skip("sh doesn't support windows", allow_module_level=True) +elif sys.platform.startswith("darwin") and os.getenv("CI"): + pytest.skip("skipping slow macOS tests on CI", allow_module_level=True) @pytest.fixture @@ -157,7 +161,6 @@ def test_project_generation(cookies, context, context_override): check_paths(paths) -@pytest.mark.skipif(IS_WINDOWS, reason="sh doesn't support windows") @pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id) def test_flake8_passes(cookies, context_override): """Generated project should pass flake8.""" @@ -169,7 +172,6 @@ def test_flake8_passes(cookies, context_override): pytest.fail(e.stdout.decode()) -@pytest.mark.skipif(IS_WINDOWS, reason="sh doesn't support windows") @pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id) def test_black_passes(cookies, context_override): """Generated project should pass black.""" diff --git a/tests/test_docker.sh b/tests/test_docker.sh index 8d25a8e2..f554e866 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -6,9 +6,6 @@ set -o errexit set -x -# install test requirements -pip install -r requirements.txt - # create a cache directory mkdir -p .cache/docker cd .cache/docker