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

Delta Between Two Patch Sets: tests/test_page_outputs.py

Issue 29755806: Noissue - convert test_page_outputs to pytest-regtest (Closed)
Left Patch Set: Created April 18, 2018, 9:30 p.m.
Right Patch Set: Combine page outputs Created April 23, 2018, 8:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « tests/expected_output/en/translate-tmpl ('k') | tox.ini » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 from __future__ import print_function 1 from __future__ import print_function
2 2
3 import os 3 import os
4 import sys 4 import sys
5 import runpy 5 import runpy
6 import pytest 6 import pytest
7 import urllib2 7 import urllib2
8 8
9 from .conftest import PAGE_LIST, LANG_LIST 9 from .conftest import PAGE_LIST, LANG_LIST
10 from .utils import get_dir_contents, run_test_server 10 from .utils import get_dir_contents, run_test_server
(...skipping 19 matching lines...) Expand all
30 def dynamic_server(temp_site): 30 def dynamic_server(temp_site):
31 with run_test_server(temp_site) as ts: 31 with run_test_server(temp_site) as ts:
32 yield ts 32 yield ts
33 33
34 34
35 @pytest.fixture(scope='session') 35 @pytest.fixture(scope='session')
36 def output_pages(static_output): 36 def output_pages(static_output):
37 return get_dir_contents(static_output) 37 return get_dir_contents(static_output)
38 38
39 39
40 @pytest.mark.parametrize('page', PAGE_LIST) 40 def test_static(regtest, output_pages, revision):
41 @pytest.mark.parametrize('lang', LANG_LIST) 41 for path in output_pages:
42 def test_static(regtest, output_pages, revision, page, lang): 42 regtest.write('### {} ###\n{}\n'.format(path, output_pages[path]))
43 path = '{}/{}'.format(lang, page)
44 if path in output_pages:
45 regtest.write(output_pages[path])
46 else:
47 regtest.write('## MISSING')
48 43
49 44
50 @pytest.mark.parametrize('page', PAGE_LIST) 45 def test_dynamic(regtest, dynamic_server):
51 @pytest.mark.parametrize('lang', LANG_LIST) 46 for lang in LANG_LIST:
52 def test_dynamic(regtest, dynamic_server, page, lang): 47 for page in PAGE_LIST:
53 path = '{}/{}'.format(lang, page) 48 path = '{}/{}'.format(lang, page)
54 response = urllib2.urlopen(dynamic_server + path) 49 response = urllib2.urlopen(dynamic_server + path)
55 regtest.write(response.read()) 50 regtest.write('### {} ###\n{}\n'.format(path, response.read()))
56 51
57 52
58 def test_revision_arg(revision, output_pages): 53 def test_revision_arg(revision, output_pages):
59 if revision is None: 54 if revision is None:
60 assert 'en/bar' in output_pages 55 assert 'en/bar' in output_pages
61 else: 56 else:
62 assert 'en/bar' not in output_pages 57 assert 'en/bar' not in output_pages
LEFTRIGHT

Powered by Google App Engine
This is Rietveld