Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/utils.py

Issue 29933596: Issue 5333 - Allow cms to generate relative pages (Closed) Base URL: https://hg.adblockplus.org/cms/
Patch Set: Address comments on PS1, rearrange test files Created Nov. 6, 2018, 3:28 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cms/converters.py ('K') | « tests/test_page_outputs.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/utils.py
===================================================================
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -29,15 +29,23 @@
)
-def get_dir_contents(path):
+def get_dir_contents(path, test_type=False):
# TODO: This function is duplicated in test_page_outputs.py.
dirdata = {}
for dirpath, dirnames, filenames in os.walk(path):
for output_file in filenames:
filepath = os.path.join(dirpath, output_file)
with open(filepath) as f:
- locale = os.path.split(os.path.split(filepath)[0])[1]
- dirdata[os.path.join(locale, output_file)] = f.read().strip()
+ if test_type:
+ locale = os.path.split(os.path.split(os.path.split
+ (filepath)[0])[0])[1]
+ test_type = os.path.split(os.path.split(filepath)[0])[1]
+ dirdata[os.path.join(locale, test_type,
+ output_file)] = f.read().strip()
+ else:
+ locale = os.path.split(os.path.split(filepath)[0])[1]
+ dirdata[os.path.join(locale,
+ output_file)] = f.read().strip()
return dirdata
« cms/converters.py ('K') | « tests/test_page_outputs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld