Add test for non-localized date parsing
This commit is contained in:
parent
1a6cb48ea0
commit
edbfe95f45
@ -52,6 +52,11 @@ cache:
|
|||||||
- directories:
|
- directories:
|
||||||
- $HOME/.pyenv_cache
|
- $HOME/.pyenv_cache
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- language-pack-de
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- source ./.travis/before_install.sh
|
- source ./.travis/before_install.sh
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
from fontTools.misc.py23 import *
|
from fontTools.misc.py23 import *
|
||||||
from fontTools.misc.timeTools import asctime, timestampNow, epoch_diff
|
from fontTools.misc.timeTools import asctime, timestampNow, timestampToString, timestampFromString, epoch_diff
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import locale
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@ -21,3 +22,17 @@ def test_source_date_epoch():
|
|||||||
|
|
||||||
del os.environ["SOURCE_DATE_EPOCH"]
|
del os.environ["SOURCE_DATE_EPOCH"]
|
||||||
assert timestampNow() + epoch_diff != 150687315
|
assert timestampNow() + epoch_diff != 150687315
|
||||||
|
|
||||||
|
|
||||||
|
# test for issue #1838
|
||||||
|
def test_date_parsing_with_locale():
|
||||||
|
l = locale.getlocale(locale.LC_TIME)
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME, 'de_DE.utf8')
|
||||||
|
except locale.Error:
|
||||||
|
pytest.skip("Locale de_DE not available")
|
||||||
|
|
||||||
|
try:
|
||||||
|
assert timestampFromString(timestampToString(timestampNow()))
|
||||||
|
finally:
|
||||||
|
locale.setlocale(locale.LC_TIME, l)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user