From 04b412dd5b0ce2b6dbcafa5f365225ae5cfcd428 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Sat, 25 Feb 2017 11:20:40 -0800 Subject: [PATCH] Test walking subdirectories, and using new unicode path --- tests/test_locale/test_os_walk.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_locale/test_os_walk.py diff --git a/tests/test_locale/test_os_walk.py b/tests/test_locale/test_os_walk.py new file mode 100644 index 000000000..d97822885 --- /dev/null +++ b/tests/test_locale/test_os_walk.py @@ -0,0 +1,26 @@ +import os +import platform +from tests.test_locale.locale_functions import GetPath + +def test_os_walk(): + os_name = platform.system() + current_directory = os.path.dirname(os.path.abspath(unicode(__file__))) + subfolders = os.listdir(current_directory) + subfolders = [e for e in subfolders if not (e.endswith(".py") or e.endswith(".pyc") or e.endswith(".md"))] + + subfolder_count = 0 + for subfolder in subfolders: + subdir = GetPath(current_directory, subfolder) + testfile = GetPath(subdir, "testcodec") + + try: + with open(testfile, 'r') as f: + read_data = f.read() + f.closed + except: + assert False, "Failed to read file." + + assert read_data == "True" + subfolder_count += 1 + + assert len(subfolders) == subfolder_count \ No newline at end of file