diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c775ec..b6cfc90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,7 @@ name: Tests (tox) on: push: - branches: [master] + branches: [master, win32_unicode] pull_request: branches: [master] @@ -18,13 +18,8 @@ jobs: matrix: py: - "3.12" - - "3.11" - - "3.10" - - "3.9" - "3.8" os: - - ubuntu-latest - - macos-latest - windows-latest steps: - uses: actions/checkout@v3 diff --git a/gcalcli/argparsers.py b/gcalcli/argparsers.py index a91a2e0..a19e534 100644 --- a/gcalcli/argparsers.py +++ b/gcalcli/argparsers.py @@ -318,7 +318,10 @@ def get_argument_parser(): help='update calendar from agenda TSV file', description='Update calendar from agenda TSV file.') agendaupdate.add_argument( - 'file', type=argparse.FileType('r'), nargs='?', default=sys.stdin) + 'file', + type=argparse.FileType('r', encoding='utf-8', errors='replace'), + nargs='?', + default=sys.stdin) sub.add_parser( 'updates', @@ -395,7 +398,10 @@ def get_argument_parser(): 'must be specified. Reads from stdin when no file argument is ' 'provided.') _import.add_argument( - 'file', type=argparse.FileType('r'), nargs='?', default=None) + 'file', + type=argparse.FileType('r', encoding='charmap', errors='replace'), + nargs='?', + default=None) _import.add_argument( '--verbose', '-v', action='count', help='Be verbose on imports') _import.add_argument( diff --git a/gcalcli/gcal.py b/gcalcli/gcal.py index b7ebb50..9133c40 100644 --- a/gcalcli/gcal.py +++ b/gcalcli/gcal.py @@ -1569,6 +1569,7 @@ def CreateEventFromVOBJ(ve): self.printer.err_msg('Error: ' + str(e) + '!\n') sys.exit(1) + self.printer.err_msg(f'{f.encoding=}') while True: try: v = next(vobject.readComponents(f)) diff --git a/tests/test_gcalcli.py b/tests/test_gcalcli.py index 7d51d95..a065e0d 100644 --- a/tests/test_gcalcli.py +++ b/tests/test_gcalcli.py @@ -6,7 +6,6 @@ from json import load import re -import pytest from dateutil.tz import tzutc from gcalcli.argparsers import ( @@ -274,14 +273,11 @@ 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(['jcrowgey@uw.edu']) gcal = PatchedGCalI(cal_names=cal_names, default_reminders=True) vcal_path = TEST_DATA_DIR + '/vv.txt' - assert gcal.ImportICS(icsFile=open(vcal_path)) + assert gcal.ImportICS(icsFile=open(vcal_path, errors='replace')) def test_parse_reminder():