Locale Tests (#1079)
* Locale tests redo * Add helper * Remove line break if found. * Fix imports * Remove copy that snuck in * Install language packs * Change language pack install * fix china language pack * Fix tests that I accidentially broke * Add debug print * Don't try and parse Travis cache dirs * Fix counting
This commit is contained in:
36
tests/test_locale/test_Pyfa/test_codec_english.py
Normal file
36
tests/test_locale/test_Pyfa/test_codec_english.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# English
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# Add root to python paths, this allows us to import submodules
|
||||
sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..', '..')))
|
||||
|
||||
from _development.helpers_locale import GetPath
|
||||
|
||||
|
||||
def test_codec_english():
|
||||
use_codec = {
|
||||
"Windows": "cp1252",
|
||||
"Linux" : "utf8",
|
||||
"Darwin" : "utf8",
|
||||
}
|
||||
|
||||
os_name = platform.system()
|
||||
current_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
try:
|
||||
decoded_file = GetPath(current_directory, "testcodec", use_codec[os_name])
|
||||
except:
|
||||
assert False, "Specified codec (" + use_codec[os_name] + ") failed to decrypt file path."
|
||||
|
||||
try:
|
||||
with open(decoded_file, 'r') as f:
|
||||
read_data = f.read()
|
||||
f.closed
|
||||
except:
|
||||
assert False, "Specified codec (" + use_codec[os_name] + ") failed to read file."
|
||||
|
||||
assert read_data == "True"
|
||||
1
tests/test_locale/test_Pyfa/testcodec
Normal file
1
tests/test_locale/test_Pyfa/testcodec
Normal file
@@ -0,0 +1 @@
|
||||
True
|
||||
Reference in New Issue
Block a user