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

Delta Between Two Patch Sets: tests/test_additional_paths.py

Issue 29805580: Issue 6728 - Remove Mercurial dependency (Closed)
Left Patch Set: Addremove files to diff Created June 12, 2018, 11:01 p.m.
Right Patch Set: Address PS4 comment Created July 9, 2018, 6:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « tests/expected_output/en/sitemap@static+master ('k') | tests/test_page_outputs.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 import subprocess
17 import sys 16 import sys
18 import urllib2 17 import urllib2
19 18
20 import py 19 import py
21 import pytest 20 import pytest
22 import runpy 21 import runpy
23 22
24 from cms.sources import create_source 23 from cms.sources import create_source
25 from .utils import get_dir_contents, run_test_server 24 from .utils import get_dir_contents, run_test_server
26 25
(...skipping 27 matching lines...) Expand all
54 ap_root = tmpdir_factory.mktemp('ap_site') 53 ap_root = tmpdir_factory.mktemp('ap_site')
55 ap_root.join('settings.ini').write( 54 ap_root.join('settings.ini').write(
56 base_root.join('settings.ini').read() + 55 base_root.join('settings.ini').read() +
57 PATHS_FRAGMENT_TEMPLATE.format(base_root), 56 PATHS_FRAGMENT_TEMPLATE.format(base_root),
58 ) 57 )
59 58
60 pages = ap_root.mkdir('pages') 59 pages = ap_root.mkdir('pages')
61 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']: 60 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']:
62 pages.join(file_name).write('MAIN_SITE') 61 pages.join(file_name).write('MAIN_SITE')
63 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read()) 62 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read())
64
65 subprocess.check_call(['hg', 'init', ap_root.strpath])
66 subprocess.check_call(['hg', '-R', ap_root.strpath,
67 'commit', '-A', '-m', 'foo'])
68
69 return ap_root 63 return ap_root
70 64
71 65
72 @pytest.fixture(scope='session') 66 @pytest.fixture(scope='session')
73 def ap_static_output(tmpdir_factory, ap_site): 67 def ap_static_output(tmpdir_factory, ap_site):
74 """Generate website from two source directories, return output path.""" 68 """Generate website from two source directories, return output path."""
75 out_path = tmpdir_factory.mktemp('ap_out') 69 out_path = tmpdir_factory.mktemp('ap_out')
76 saved_argv = sys.argv 70 saved_argv = sys.argv
77 sys.argv = ['', ap_site.strpath, out_path.strpath] 71 sys.argv = ['', ap_site.strpath, out_path.strpath]
78 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__') 72 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__')
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 three.join('three').write('') 109 three.join('three').write('')
116 three.join('settings.ini').write('') 110 three.join('settings.ini').write('')
117 111
118 four.join('four').write('') 112 four.join('four').write('')
119 four.join('settings.ini').write('[paths]') 113 four.join('settings.ini').write('[paths]')
120 114
121 source = create_source(one.strpath) 115 source = create_source(one.strpath)
122 116
123 for name in ['one', 'two', 'three', 'four']: 117 for name in ['one', 'two', 'three', 'four']:
124 assert source.has_file(name) 118 assert source.has_file(name)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld