OLD | NEW |
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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 @pytest.fixture(scope='session') | 48 @pytest.fixture(scope='session') |
49 def ap_site(temp_site, tmpdir_factory): | 49 def ap_site(temp_site, tmpdir_factory): |
50 """A website source that has another website in additional-paths.""" | 50 """A website source that has another website in additional-paths.""" |
51 base_root = py.path.local(temp_site) | 51 base_root = py.path.local(temp_site) |
52 base_pages = base_root.join('pages') | 52 base_pages = base_root.join('pages') |
53 | 53 |
54 ap_root = tmpdir_factory.mktemp('ap_site') | 54 ap_root = tmpdir_factory.mktemp('ap_site') |
55 ap_root.join('settings.ini').write( | 55 ap_root.join('settings.ini').write( |
56 base_root.join('settings.ini').read() + | 56 base_root.join('settings.ini').read() + |
57 PATHS_FRAGMENT_TEMPLATE.format(base_root) | 57 PATHS_FRAGMENT_TEMPLATE.format(base_root), |
58 ) | 58 ) |
59 | 59 |
60 pages = ap_root.mkdir('pages') | 60 pages = ap_root.mkdir('pages') |
61 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']: | 61 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']: |
62 pages.join(file_name).write('MAIN_SITE') | 62 pages.join(file_name).write('MAIN_SITE') |
63 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read()) | 63 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read()) |
64 | 64 |
65 subprocess.check_call(['hg', 'init', ap_root.strpath]) | 65 subprocess.check_call(['hg', 'init', ap_root.strpath]) |
66 subprocess.check_call(['hg', '-R', ap_root.strpath, | 66 subprocess.check_call(['hg', '-R', ap_root.strpath, |
67 'commit', '-A', '-m', 'foo']) | 67 'commit', '-A', '-m', 'foo']) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 three.join('three').write('') | 115 three.join('three').write('') |
116 three.join('settings.ini').write('') | 116 three.join('settings.ini').write('') |
117 | 117 |
118 four.join('four').write('') | 118 four.join('four').write('') |
119 four.join('settings.ini').write('[paths]') | 119 four.join('settings.ini').write('[paths]') |
120 | 120 |
121 source = create_source(one.strpath) | 121 source = create_source(one.strpath) |
122 | 122 |
123 for name in ['one', 'two', 'three', 'four']: | 123 for name in ['one', 'two', 'three', 'four']: |
124 assert source.has_file(name) | 124 assert source.has_file(name) |
OLD | NEW |