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

Unified Diff: tests/test_page_outputs.py

Issue 29400555: Issue 4992 - Adds optional revision arg to generate_static_pages (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: address comments for argparse descriptions Created April 3, 2017, 10:47 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
Index: tests/test_page_outputs.py
===================================================================
--- a/tests/test_page_outputs.py
+++ b/tests/test_page_outputs.py
@@ -23,19 +23,22 @@
return get_dir_contents(expected_out_path).items()
expected_outputs = get_expected_outputs()
@pytest.fixture(scope='session')
def static_output(request, temp_site):
static_out_path = os.path.join(temp_site, 'static_out')
- sys.argv = ['filler', temp_site, static_out_path]
+ sys.argv = ['filler', temp_site, static_out_path+'master',
Vasily Kuznetsov 2017/04/03 13:02:19 I was actually thinking to only generate the maste
Jon Sonesen 2017/04/03 13:32:26 I am not sure how this would work then. The thing
Jon Sonesen 2017/04/03 13:49:26 As discussed over Mumble we agree this bit of dupl
+ '--rev', 'master']
runpy.run_module('cms.bin.generate_static_pages', run_name='__main__')
- return static_out_path
+ sys.argv = ['filler', temp_site, static_out_path+'default']
+ runpy.run_module('cms.bin.generate_static_pages', run_name='__main__')
+ return static_out_path + 'master', static_out_path + 'default'
@pytest.yield_fixture()
def dynamic_server(temp_site):
args = ['python', 'runserver.py', temp_site]
# Werkzeug is a dependency of flask which we are using for the mock api
# however there is an issue with Werkzeug that prevents it from properly
# handling the SIGTERM sent by p.kill() or terminate()
@@ -43,20 +46,26 @@
p = subprocess.Popen(args, stdout=subprocess.PIPE, preexec_fn=os.setsid)
time.sleep(0.5)
yield 'http://localhost:5000/root/'
os.killpg(os.getpgid(p.pid), signal.SIGTERM)
@pytest.fixture(scope='session')
def output_pages(static_output):
- return get_dir_contents(static_output)
+ return (get_dir_contents(static_output[0]),
+ get_dir_contents(static_output[1]))
@pytest.mark.parametrize('filename,expected_output', expected_outputs)
def test_static(output_pages, filename, expected_output):
- assert output_pages[filename] == expected_output
+ assert output_pages[0][filename] == expected_output
+ assert output_pages[1][filename] == expected_output
@pytest.mark.parametrize('filename,expected_output', expected_outputs)
def test_dynamic(dynamic_server, filename, expected_output):
response = urllib2.urlopen(dynamic_server + filename)
assert response.read() == expected_output
+
+
+def test_revision_arg(output_pages):
+ assert 'bar' not in output_pages[0]

Powered by Google App Engine
This is Rietveld