Skip to content

Commit a80adeb

Browse files
committed
[Unit tests] Add ICU unit test file
1 parent 48aeec0 commit a80adeb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_ICU.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import sys
6+
import unittest
7+
import pytest
8+
9+
ICU_DATA_FOLDERS_UNIX = ("/usr/share/stpyv8", os.path.expanduser("~/.local/share/stpyv8"))
10+
ICU_DATA_FOLDERS_OSX = ("/Library/Application Support/STPyV8", os.path.expanduser('~/Library/Application Support/STPyV8'))
11+
ICU_DATA_FOLDERS_WINDOWS = (os.path.join(os.environ["PROGRAMDATA"], "STPyV8") if "PROGRAMDATA" in os.environ else None, )
12+
13+
icu_data_folders = None
14+
if os.name in ("posix", ):
15+
icu_data_folders = ICU_DATA_FOLDERS_OSX if sys.platform in ("darwin", ) else ICU_DATA_FOLDERS_UNIX
16+
else:
17+
icu_data_folders = ICU_DATA_FOLDERS_WINDOWS
18+
19+
ICU_TEST_SKIP = os.name in ("nt", ) and os.getenv('PROGRAMDATA') is None
20+
21+
22+
class TestICU(unittest.TestCase):
23+
@pytest.mark.skipif(ICU_TEST_SKIP, reason = "ICU data file not available")
24+
def testIcu(self):
25+
icu_paths = (os.path.join(folder, "icudtl.dat") for folder in icu_data_folders)
26+
self.assertTrue(any(os.path.exists(icu) for icu in icu_paths))

0 commit comments

Comments
 (0)