Skip to content

Commit

Permalink
(WIP) Re-enable Windows unicode tests (and TODO: fix them)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarnett committed Aug 25, 2024
1 parent 6dbb9ac commit 9d4c0f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tests (tox)

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

Expand All @@ -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
Expand Down
10 changes: 8 additions & 2 deletions gcalcli/argparsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions gcalcli/gcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 1 addition & 5 deletions tests/test_gcalcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from json import load
import re

import pytest
from dateutil.tz import tzutc

from gcalcli.argparsers import (
Expand Down Expand Up @@ -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(['[email protected]'])
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():
Expand Down

0 comments on commit 9d4c0f3

Please sign in to comment.