Skip to content

Commit f1e3221

Browse files
author
Hugo Osvaldo Barrera
committed
Skip tests that're incompatible with pyicu
Some tests fail to run if PyICU is installed (it seems to break compatibility across a few test dependencies, nothing we use outside of tests directly).
1 parent c96eddc commit f1e3221

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ matrix:
3636
python: 3.6
3737
after_install:
3838
- echo click_repl >> requirements.txt
39+
- # Run tests with incompatible test dependencies:
40+
python: 3.6
41+
after_install:
42+
- echo pyicu >> requirements.txt
3943

4044
addons:
4145
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)