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

Unified Diff: tests/test_page_outputs.py

Issue 29753617: Issue 6545 - get_pages_metadata now returns all pages (Closed)
Patch Set: Created April 16, 2018, 11:53 p.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
« no previous file with comments | « tests/expected_output/en/sitemap@static:master ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_page_outputs.py
===================================================================
--- a/tests/test_page_outputs.py
+++ b/tests/test_page_outputs.py
@@ -12,16 +12,19 @@
expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output')
outputs = get_dir_contents(expected_out_path)
for filename in list(outputs):
# Move test-type-specific expected outputs (e.g. "xyz@static" -> "xyz")
# and remove the expected outputs that don't apply for this test type.
if filename.endswith('@' + test_type):
realname = filename.split('@')[0]
outputs[realname] = outputs[filename]
+ if ':' in filename:
Vasily Kuznetsov 2018/04/17 18:36:08 It seems like the code in this `if` is not necessa
Jon Sonesen 2018/04/17 21:02:40 As discussed very IRC the code is necessary howeve
+ realname = ''.join(filename.split('@' + test_type))
+ outputs[realname] = outputs[filename]
if '@' in filename:
del outputs[filename]
return outputs.items()
static_expected_outputs = get_expected_outputs('static')
dynamic_expected_outputs = get_expected_outputs('dynamic')
@@ -49,20 +52,23 @@
@pytest.fixture(scope='session')
def output_pages(static_output):
return get_dir_contents(static_output)
@pytest.mark.parametrize('filename,expected_output', static_expected_outputs)
-def test_static(output_pages, filename, expected_output):
+def test_static(revision, output_pages, filename, expected_output):
if expected_output.startswith('## MISSING'):
assert filename not in output_pages
- else:
+ elif revision and ':' + revision in filename:
+ filename = filename.split(':')[0]
+ assert expected_output == output_pages[filename]
+ elif not revision and ':' not in filename:
assert expected_output == output_pages[filename]
@pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs)
def test_dynamic(dynamic_server, filename, expected_output):
response = urllib2.urlopen(dynamic_server + filename)
assert expected_output == response.read().strip()
« no previous file with comments | « tests/expected_output/en/sitemap@static:master ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld