Skip to content

Commit

Permalink
Merge pull request #696 from insanum/gh-actions
Browse files Browse the repository at this point in the history
Run tox tests/linters as GitHub Action, skip failing test for Windows
  • Loading branch information
dbarnett authored Aug 24, 2024
2 parents d60ae29 + 1719058 commit 2e9b786
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*.{yml,yaml}]
indent_size = 2
42 changes: 42 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests (tox)

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
test:
name: test with ${{ matrix.py }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install tox
run: python -m pip install tox-gh>=1.2
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
run: tox --skip-pkg-install
19 changes: 14 additions & 5 deletions tests/test_gcalcli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
from __future__ import absolute_import

import os
from datetime import datetime
from json import load
import os

import pytest
from dateutil.tz import tzutc

from gcalcli.argparsers import (get_cal_query_parser, get_color_parser,
get_conflicts_parser, get_output_parser,
get_search_parser, get_start_end_parser,
get_updates_parser)
from gcalcli.argparsers import (
get_cal_query_parser,
get_color_parser,
get_conflicts_parser,
get_output_parser,
get_search_parser,
get_start_end_parser,
get_updates_parser,
)
from gcalcli.cli import parse_cal_names
from gcalcli.gcal import GoogleCalendarInterface
from gcalcli.utils import parse_reminder
Expand Down Expand Up @@ -215,6 +221,9 @@ def test_modify_event(PatchedGCalI):
gcal._edit_event, opts.text, opts.start, opts.end) == 0


@pytest.mark.skipif(
os.name == 'nt',
reason='Known unicode encode/decode issue, see insanum/gcalcli#387.')
def test_import(PatchedGCalI):
cal_names = parse_cal_names(['[email protected]'])
gcal = PatchedGCalI(cal_names=cal_names, default_reminders=True)
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ description = run linters
skip_install = true
deps = flake8
commands = flake8

[gh]
python =
3.12 = py312, lint
3.11 = py311
3.10 = py310
3.9 = py39
3.8 = py38

0 comments on commit 2e9b786

Please sign in to comment.