Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: ci test and ignore it #1063

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
minversion = 7.4
addopts = -ra -q
testpaths = tests
19 changes: 19 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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()
13 changes: 13 additions & 0 deletions tests/test_git-abort.py
Original file line number Diff line number Diff line change
@@ -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
Loading