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

Delta Between Two Patch Sets: tests/test_render_script.py

Issue 29992563: Noissue - Work around N812 and E117 from flake8 update (Closed) Base URL: https://hg.adblockplus.org/python-abp
Left Patch Set: Created Jan. 29, 2019, 4:32 p.m.
Right Patch Set: Ignore errors instead of working around the linter, avoid E117 Created Jan. 30, 2019, 10:41 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
« abp/filters/rpy.py ('K') | « abp/filters/rpy.py ('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 # 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-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 12 matching lines...) Expand all
23 23
24 import os 24 import os
25 import pytest 25 import pytest
26 import subprocess 26 import subprocess
27 import threading 27 import threading
28 28
29 try: 29 try:
30 import SimpleHTTPServer 30 import SimpleHTTPServer
31 import SocketServer 31 import SocketServer
32 except ImportError: # The modules were renamed/moved in Python 3. 32 except ImportError: # The modules were renamed/moved in Python 3.
33 from http import server 33 from http import server as SimpleHTTPServer # noqa: N812
34 import socketserver 34 import socketserver as SocketServer # noqa: N812
35 SimpleHTTPServer, SocketServer = server, socketserver
rhowell 2019/01/29 20:28:39 Just curious, why not do it in 2 lines instead of
Vasily Kuznetsov 2019/01/30 10:42:48 I was trying to avoid disabling the linter. But al
36 35
37 36
38 @pytest.fixture 37 @pytest.fixture
39 def rootdir(tmpdir): 38 def rootdir(tmpdir):
40 """Directory with prepared list fragments.""" 39 """Directory with prepared list fragments."""
41 rootdir = tmpdir.join('root') 40 rootdir = tmpdir.join('root')
42 rootdir.mkdir() 41 rootdir.mkdir()
43 # Simple file with just `Ok` and a non-ascii unicode character in it. 42 # Simple file with just `Ok` and a non-ascii unicode character in it.
44 rootdir.join('simple.txt').write('[Adblock]\nOk') 43 rootdir.join('simple.txt').write('[Adblock]\nOk')
45 # Fragment with a non-ascii character. 44 # Fragment with a non-ascii character.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 202
204 @pytest.mark.slowtest 203 @pytest.mark.slowtest
205 def test_failed_web_include(rootdir, dstfile, webserver_port): 204 def test_failed_web_include(rootdir, dstfile, webserver_port):
206 url = 'http://localhost:{}/missing.txt'.format(webserver_port) 205 url = 'http://localhost:{}/missing.txt'.format(webserver_port)
207 webinc = rootdir.join('webinc.txt') 206 webinc = rootdir.join('webinc.txt')
208 webinc.write('[Adblock]\n%include {}%'.format(url)) 207 webinc.write('[Adblock]\n%include {}%'.format(url))
209 code, err, _ = run_script(str(webinc), str(dstfile)) 208 code, err, _ = run_script(str(webinc), str(dstfile))
210 assert code == 1 209 assert code == 1
211 assert err.startswith( 210 assert err.startswith(
212 "HTTP 404 Not found: '{0}' when including '{0}'".format(url)) 211 "HTTP 404 Not found: '{0}' when including '{0}'".format(url))
LEFTRIGHT

Powered by Google App Engine
This is Rietveld