From 37168c453c463f7b74f3f47683de51fc055e94c6 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Thu, 15 Aug 2024 17:22:19 +0200 Subject: [PATCH] Followup fixes to new test suite/CI --- .github/workflows/test-action.yml | 8 +++++--- tests/conftest.py | 5 ++++- tests/test_basics.py | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 0b305c0..d91b797 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -15,7 +15,9 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 2 # coverage: Issue detecting commit SHA + # We need the full history for update tests + fetch-depth: 0 + fetch-tags: true - name: Set up Python 3.12 uses: actions/setup-python@v5 @@ -29,13 +31,13 @@ jobs: - name: Install Test Requirements run: | - nox --force-color -e tests-3 --install-only + nox --force-color -e tests --install-only - name: Test env: SKIP_REQUIREMENTS_INSTALL: true run: | - nox --force-color -e tests-3 -- -vv tests/ + nox --force-color -e tests -- -vv tests/ # - name: Create CodeCov Flags # if: always() diff --git a/tests/conftest.py b/tests/conftest.py index 7b01940..7ae1394 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -77,9 +77,12 @@ def project(answers, request, copie): yield res.project_dir +@pytest.fixture def project_committed(project): with local.cwd(project): - git = local["git"]["-c", "commit.gpgsign=false"] + git = local["git"][ + "-c", "commit.gpgsign=false", "-c", "user.name=foobar", "-c", "user.email=foo@b.ar" + ] git("init") git("add", ".") git("commit", "-m", "initial commit") diff --git a/tests/test_basics.py b/tests/test_basics.py index cb583eb..9b5dc54 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -43,8 +43,10 @@ def test_update_from_002_works(copie, project): def _commit_with_pre_commit(venv, max_retry=3, message="initial commit"): - git = local["git"]["-c", "commit.gpgsign=false"] - venv.run("pre-commit", "install") + git = local["git"][ + "-c", "commit.gpgsign=false", "-c", "user.name=foobar", "-c", "user.email=foo@b.ar" + ] + venv.run(venv.venv_python, "-m", "pre_commit", "install") retry_count = 1 saved_err = None