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

Side by Side Diff: tests/test_renderer.py

Issue 29341320: Noissue - Added flake8-abp and pep8-naming extension and fix reported warnings (Closed)
Patch Set: Revert changes of patch set 2 Created May 27, 2016, 12:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/test_render_script.py ('k') | tox.ini » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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 17 matching lines...) Expand all
28 patcher = mock.patch('time.gmtime') 28 patcher = mock.patch('time.gmtime')
29 gmtime_mock = patcher.start() 29 gmtime_mock = patcher.start()
30 request.addfinalizer(patcher.stop) 30 request.addfinalizer(patcher.stop)
31 gmtime_mock.return_value = time.struct_time([2001] + [1] * 8) 31 gmtime_mock.return_value = time.struct_time([2001] + [1] * 8)
32 return gmtime_mock 32 return gmtime_mock
33 33
34 34
35 @pytest.fixture() 35 @pytest.fixture()
36 def head(gmtime): 36 def head(gmtime):
37 """Typical start of the rendered list.""" 37 """Typical start of the rendered list."""
38 version = time.strftime("%Y%m%d%H%M", gmtime()) 38 version = time.strftime('%Y%m%d%H%M', gmtime())
39 return '[Adblock]\n! Version: {}\n'.format(version) 39 return '[Adblock]\n! Version: {}\n'.format(version)
40 40
41 41
42 class MockSource(object): 42 class MockSource(object):
43 43
44 def __init__(self, **kw): 44 def __init__(self, **kw):
45 self.is_inheritable = kw.get('is_inheritable', True) 45 self.is_inheritable = kw.get('is_inheritable', True)
46 self.files = kw 46 self.files = kw
47 47
48 def get(self, filename): 48 def get(self, filename):
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 src2 = MockSource(is_inheritable=False, 111 src2 = MockSource(is_inheritable=False,
112 inc1='%include inc2%', inc2='Included') 112 inc1='%include inc2%', inc2='Included')
113 with pytest.raises(IncludeError): 113 with pytest.raises(IncludeError):
114 render_str('src1:fl', {'src1': src1, 'src2': src2}) 114 render_str('src1:fl', {'src1': src1, 'src2': src2})
115 115
116 116
117 def test_missing_header(): 117 def test_missing_header():
118 src = MockSource(fl='! No header') 118 src = MockSource(fl='! No header')
119 with pytest.raises(MissingHeader): 119 with pytest.raises(MissingHeader):
120 render_str('fl', {}, src) 120 render_str('fl', {}, src)
OLDNEW
« no previous file with comments | « tests/test_render_script.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld