MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / test_os_walk

Function test_os_walk

tests/test_locale/test_os_walk.py:10–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8from _development.helpers_locale import GetPath
9
10def test_os_walk():
11 current_directory = os.path.dirname(os.path.abspath(str(__file__)))
12 subfolders = os.listdir(current_directory)
13 subfolders = [e for e in subfolders if not (e.endswith(".py") or e.endswith(".pyc") or e.endswith(".md"))]
14
15 subfolder_count = 0
16 for subfolder in subfolders:
17 subdir = GetPath(current_directory, subfolder)
18 testfile = GetPath(subdir, "testcodec")
19
20 if "__pycache__" in testfile:
21 # Grabbed a Travis temp folder, skip any assertions, but count it.
22 subfolder_count += 1
23 continue
24
25 # noinspection PyBroadException
26 try:
27 with open(testfile, 'r') as f:
28 read_data = f.read()
29 # noinspection PyStatementEffect
30 f.closed
31 except:
32 print("Test File:")
33 print(testfile)
34 assert False, "Failed to read file."
35
36 read_data = read_data.replace("\n", "")
37 assert read_data == "True"
38 subfolder_count += 1
39
40 assert len(subfolders) == subfolder_count

Callers

nothing calls this directly

Calls 2

GetPathFunction · 0.90
replaceMethod · 0.80

Tested by

no test coverage detected