diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7e84d3ec..8bcf45ac9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,27 @@ jobs: pip install codespell==2.2 git grep --cached -l '' | grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | xargs codespell --ignore-words=.github/.ignore_words + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ['3.10'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest==7.4.0 + - name: Unit test + run: | + pytest + build: strategy: fail-fast: false diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 8f1e6539f..000000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: extras PR test - -run-name: ${{ github.actor }} is testing - -on: - pull_request: - branches: [master] - -jobs: - test: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: ['3.10'] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest==7.4.0 - - name: Test - run: | - pytest diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..d8abd7e29 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,19 @@ +import os +import subprocess +import tempfile +import pytest + +@pytest.fixture(scope="module") +def git_repo(): + tmp_dir = tempfile.TemporaryDirectory() + tmp_file_a = tempfile.TemporaryFile(mode="w+b", dir=tmp_dir.name) + tmp_file_b = tempfile.TemporaryFile(mode="w+b", dir=tmp_dir.name) + os.chdir(tmp_dir.name) + result = subprocess.run(["git", "init"], capture_output=True) + print(result) + result = subprocess.run(["git", "add", "."], capture_output=True) + print(result) + result = subprocess.run(["git", "commit", "-m", "initial commit"], capture_output=True) + print(result) + yield [tmp_dir, tmp_file_a, tmp_file_b] + tmp_dir.cleanup() diff --git a/tests/test_git-abort.py b/tests/test_git-abort.py new file mode 100644 index 000000000..f2b624761 --- /dev/null +++ b/tests/test_git-abort.py @@ -0,0 +1,13 @@ +class TestGitAbort: + def test_cherry_pick(self, git_repo): + print(git_repo) + assert 1 == 2 + + def test_merge(self, git_repo): + assert 2 == 3 + + def test_rebase(self): + assert 3 == 4 + + def test_revert(self): + assert 4 == 4