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

Delta Between Two Patch Sets: tests/test_page_outputs.py

Issue 29512555: Noissue - Adds better locale support to test suite (Closed)
Left Patch Set: Created Aug. 11, 2017, 6:25 a.m.
Right Patch Set: remove pointless sort Created Aug. 11, 2017, 7:43 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 ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import os 1 import os
2 import sys 2 import sys
3 import time 3 import time
4 import runpy 4 import runpy
5 import signal 5 import signal
6 import pytest 6 import pytest
7 import urllib2 7 import urllib2
8 import subprocess 8 import subprocess
9 from conftest import ROOTPATH 9 from conftest import ROOTPATH
10 10
11 11
12 def get_dir_contents(path): 12 def get_dir_contents(path):
13 dirdata = {} 13 dirdata = {}
14 for dirpath, dirnames, filenames in sorted(os.walk(path)): 14 for dirpath, dirnames, filenames in os.walk(path):
Vasily Kuznetsov 2017/08/11 07:08:08 We're putting the result into a dictionary here. D
Jon Sonesen 2017/08/11 07:43:55 There is no difference i meant to remove this than
15 for output_file in filenames: 15 for output_file in filenames:
16 filepath = os.path.join(dirpath, output_file) 16 filepath = os.path.join(dirpath, output_file)
17 with open(filepath) as f: 17 with open(filepath) as f:
18 locale = os.path.split(os.path.split(filepath)[0])[1] 18 locale = os.path.split(os.path.split(filepath)[0])[1]
19 dirdata[os.path.join(locale, output_file)] = f.read().strip() 19 dirdata[os.path.join(locale, output_file)] = f.read().strip()
20 return dirdata 20 return dirdata
21 21
22 22
23 def get_expected_outputs(test_type): 23 def get_expected_outputs(test_type):
24 expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output') 24 expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output')
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 def test_dynamic(dynamic_server, filename, expected_output): 81 def test_dynamic(dynamic_server, filename, expected_output):
82 response = urllib2.urlopen(dynamic_server + filename) 82 response = urllib2.urlopen(dynamic_server + filename)
83 assert response.read().strip() == expected_output 83 assert response.read().strip() == expected_output
84 84
85 85
86 def test_revision_arg(revision, output_pages): 86 def test_revision_arg(revision, output_pages):
87 if revision is None: 87 if revision is None:
88 assert 'en/bar' in output_pages 88 assert 'en/bar' in output_pages
89 else: 89 else:
90 assert 'en/bar' not in output_pages 90 assert 'en/bar' not in output_pages
LEFTRIGHT

Powered by Google App Engine
This is Rietveld