Skip to content

Commit 35b1460

Browse files
author
Hugo Osvaldo Barrera
authored
Merge pull request #276 from pimutils/pyicu-tests-compat
Skip tests that're incompatible with PyICU
2 parents 0e67003 + 5a0daf8 commit 35b1460

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ matrix:
3636
python: 3.6
3737
after_install:
3838
- echo click_repl >> requirements.txt
39+
env: TOXENV=py EXTRAS=click_repl
40+
- # Run tests with incompatible test dependencies:
41+
python: 3.6
42+
after_install:
43+
- echo pyicu >> requirements.txt
44+
env: TOXENV=py EXTRAS=pyicu
3945

4046
addons:
4147
apt:

tests/helpers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
__all__ = [
2+
'pyicu_sensitive',
3+
]
4+
5+
import pytest
6+
7+
8+
def is_pyicu_installed():
9+
try:
10+
import icu # noqa: F401: This is an import to tests if it's installed.
11+
except ImportError:
12+
return False
13+
else:
14+
return True
15+
16+
17+
pyicu_sensitive = pytest.mark.skipif(
18+
is_pyicu_installed(),
19+
reason="This test cannot be run with pyicu installed.",
20+
)

tests/test_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from freezegun import freeze_time
1212
from hypothesis import given
1313

14+
from tests.helpers import pyicu_sensitive
1415
from todoman.cli import cli, exceptions
1516
from todoman.model import Database, Todo
1617

@@ -209,6 +210,7 @@ def test_move(tmpdir, runner, create):
209210
assert 'other_list' in result.output
210211

211212

213+
@pyicu_sensitive
212214
@freeze_time('2017-03-17 20:22:19')
213215
def test_dtstamp(tmpdir, runner, create):
214216
"""Test that we add the DTSTAMP to new entries as per RFC5545."""
@@ -263,6 +265,7 @@ def test_default_due(
263265
)
264266

265267

268+
@pyicu_sensitive
266269
@freeze_time(datetime.datetime.now())
267270
def test_default_due2(tmpdir, runner, create, todos):
268271
cfg = tmpdir.join('config')
@@ -644,6 +647,7 @@ def test_todo_edit(runner, default_database, todo_factory):
644647
assert 'YARR!' in result.output
645648

646649

650+
@pyicu_sensitive
647651
@freeze_time('2017, 3, 20')
648652
def test_list_startable(tmpdir, runner, todo_factory):
649653
todo_factory(summary='started', start=datetime.datetime(2017, 3, 15))

tests/test_formatter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import pytz
55
from freezegun import freeze_time
66

7+
from tests.helpers import pyicu_sensitive
78
from todoman.cli import cli
89
from todoman.formatters import rgb_to_ansi
910

1011

12+
@pyicu_sensitive
1113
@pytest.mark.parametrize('interval', [
1214
(65, 'in a minute'),
1315
(-10800, '3 hours ago'),

0 commit comments

Comments
 (0)