cmds: lint Python files
Also fix all the accumulated lint in cmds.
Change-Id: I45d0104d5a1ed9f535cab72e422dbd17aa1f7c26
diff --git a/cmds/Makefile b/cmds/Makefile
index 45580b2..4bcca65 100644
--- a/cmds/Makefile
+++ b/cmds/Makefile
@@ -3,6 +3,13 @@
PREFIX=/
BINDIR=$(DESTDIR)$(PREFIX)/bin
LIBDIR=$(DESTDIR)$(PREFIX)/lib
+GPYLINT=$(shell \
+ if which gpylint >/dev/null; then \
+ echo gpylint; \
+ else \
+ echo 'echo "(gpylint-missing)" >&2'; \
+ fi \
+)
PORTABLE_TARGETS=\
balloon \
@@ -291,9 +298,15 @@
./$$d; \
done
-test: all $(TESTS)
+lint: $(filter-out options.py,$(wildcard *.py))
+ $(GPYLINT) $^
+
+test_only: all
./wvtest/wvtestrun $(MAKE) runtests
+test: all $(TESTS)
+ $(MAKE) test_only lint
+
clean:
rm -f *.o $(TARGETS) \
$(HOST_TARGETS) \
diff --git a/cmds/bsa2bluez.py b/cmds/bsa2bluez.py
index 159c1b4..d3db9cf 100755
--- a/cmds/bsa2bluez.py
+++ b/cmds/bsa2bluez.py
@@ -1,8 +1,11 @@
#!/usr/bin/python
+"""bsa2bluez: Automatic device import from Broadcom BSA to BlueZ."""
import os
+import sys
import xml.etree.ElementTree as ET
+
def create_device_info_file(filename, link_key):
with open(filename, 'w') as f:
f.write('\n')
@@ -16,6 +19,7 @@
f.write('SupportedTechnologies=BR/EDR;\n')
f.write('Trusted=true\n')
f.write('Blocked=false\n')
+ # pylint: disable=line-too-long
f.write('Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;\n')
f.write('Class=0x00050c\n')
f.write('\n')
@@ -25,6 +29,7 @@
f.write('Product=8192\n')
f.write('Version=283\n')
+
def create_device_cache_file(filename):
with open(filename, 'w') as f:
f.write('\n')
@@ -32,47 +37,45 @@
f.write('Name=GFRM100\n')
f.write('\n')
f.write('[ServiceRecords]\n')
+ # pylint: disable=line-too-long
f.write('0x00000000=35920900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A09010009000935083506190100090100090100252D42726F6164636F6D20426C7565746F6F746820576972656C6573732052656D6F74652053445020536572766572090101250E52656D6F746520436F6E74726F6C0902003503090100\n')
f.write('0x00010000=3601B60900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010009000D350F350D350619010009001335031900110901002517476F6F676C6554562052656D6F746520436F6E74726F6C09010125214D756C74692D66756E6374696F6E2072656D6F74652077697468206B65797061640901022506476F6F676C6509020009017109020109011109020208400902030821090204280109020528010902063600BB3600B808222600B305010906A10185417508950126FF00050719002AFF008100C0050C0901A101854019002AFF0375109501150026FF038100C005010980A10185121981299315812593750895018140C0050C0901A1018513092015002564750895018142C08521092175089501150026FF008102852205010922A102093B950175101500264F01810206F0FF09227510964F01150026FF00820102C085F2090275089501150026FF00910285F3090375089510150026FF0081020902073508350609040909010009020B09010009020C090C8009020D280009020E280109020F090318090210090000\n')
f.write('0x00010001=35520900000A000100010900013503191200090004350D350619010009000135031900010900093508350619120009010009020009010009020109005809020209200009020309011B0902042801090205090001\n')
-def main():
- BT_MAC_FILE='/tmp/btmacaddress'
- BSA_DEVICES_FILE='/user/bsa/bt_devices.xml'
- BLUEZ_STORAGE_DIR='/user/bluez/lib/bluetooth'
+BT_MAC_FILE = '/tmp/btmacaddress'
+BSA_DEVICES_FILE = '/user/bsa/bt_devices.xml'
+BLUEZ_STORAGE_DIR = '/user/bluez/lib/bluetooth'
+
+
+def main():
if not os.path.exists(BT_MAC_FILE):
- print 'error: %s does not exist' % BT_MAC_FILE
- return
+ sys.exit('error: %s does not exist' % BT_MAC_FILE)
with open(BT_MAC_FILE, 'r') as f:
bt_mac = f.read().upper().rstrip('\n')
if len(bt_mac) != 17:
- print 'error: bt_mac %s is invalid' % bt_mac
- return
-
- if not os.path.exists(BSA_DEVICES_FILE):
- print 'error: %s does not exist' % BSA_DEVICES_FILE
- return
+ sys.exit('error: bt_mac %s is invalid' % bt_mac)
try:
bsa_devices = ET.parse(BSA_DEVICES_FILE)
- except:
- print 'error: %s cannot be parsed' % BSA_DEVICES_FILE
+ except ET.ParseError as e:
+ print >>sys.stderr, 'error: failed to parse %r with exception %r' % (
+ BSA_DEVICES_FILE, e)
with open(BSA_DEVICES_FILE, 'r') as f:
- buffer = f.read()
- print buffer[0:4096]
- return
+ buf = f.read()
+ print >>sys.stderr, buf[0:4096]
+ sys.exit(1)
adapter_dir = BLUEZ_STORAGE_DIR + '/' + bt_mac
if not os.path.isdir(adapter_dir):
- print 'create: BlueZ adapter dir %s' % adapter_dir
+ print >>sys.stderr, 'create: BlueZ adapter dir %s' % adapter_dir
os.makedirs(adapter_dir)
device_cache_dir = adapter_dir + '/cache'
if not os.path.isdir(device_cache_dir):
- print 'create: BlueZ device cache dir %s' % device_cache_dir
+ print >>sys.stderr, 'create: BlueZ device cache dir %s' % device_cache_dir
os.makedirs(device_cache_dir)
for parent in bsa_devices.getiterator():
@@ -90,36 +93,40 @@
bd_addr = bd_addr.upper()
if len(bd_addr) != 17:
- print 'BSA device: GFRM100 has invalid bd_addr %s' % bd_addr
+ print >>sys.stderr, 'BSA device: GFRM100 has invalid bd_addr %s' % bd_addr
continue
link_key = link_key.upper().replace(':', '')
if len(link_key) != 32:
- print 'BSA device: GFRM100 has invalid link_key %s' % link_key
+ print >>sys.stderr, ('BSA device: GFRM100 has invalid link_key %s'
+ % link_key)
continue
- print 'BSA device: GFRM100 at bd_addr %s link_key %s' % (bd_addr, link_key)
+ print >>sys.stderr, ('BSA device: GFRM100 at bd_addr %s link_key %s'
+ % (bd_addr, link_key))
device_dir = adapter_dir + '/' + bd_addr
if not os.path.isdir(device_dir):
- print 'create: BlueZ device dir %s' % device_dir
+ print >>sys.stderr, 'create: BlueZ device dir %s' % device_dir
os.makedirs(device_dir)
else:
- print 'exists: BlueZ device dir %s' % device_dir
+ print >>sys.stderr, 'exists: BlueZ device dir %s' % device_dir
device_info_file = device_dir + '/info'
if not os.path.exists(device_info_file):
- print 'create: BlueZ device info file %s' % device_info_file
+ print >>sys.stderr, 'create: BlueZ device info file %s' % device_info_file
create_device_info_file(device_info_file, link_key)
else:
- print 'exists: BlueZ device info file %s' % device_info_file
+ print >>sys.stderr, 'exists: BlueZ device info file %s' % device_info_file
device_cache_file = device_cache_dir + '/' + bd_addr
if not os.path.exists(device_cache_file):
- print 'create: BlueZ device cache file %s' % device_cache_file
+ print >>sys.stderr, ('create: BlueZ device cache file %s'
+ % device_cache_file)
create_device_cache_file(device_cache_file)
else:
- print 'exists: BlueZ device cache file %s' % device_cache_file
+ print >>sys.stderr, ('exists: BlueZ device cache file %s'
+ % device_cache_file)
if __name__ == '__main__':
main()
diff --git a/cmds/burnin-flash.py b/cmds/burnin-flash.py
index d00c719..80dbfcd 100755
--- a/cmds/burnin-flash.py
+++ b/cmds/burnin-flash.py
@@ -5,8 +5,6 @@
__author__ = 'dgentry@google.com (Denton Gentry)'
-import ctypes
-import fcntl
import os
import os.path
import subprocess
@@ -17,7 +15,7 @@
try:
- import monotime # pylint: disable-msg=unused-import,g-import-not-at-top
+ import monotime # pylint: disable=unused-import,g-import-not-at-top
except ImportError:
pass
try:
@@ -26,7 +24,6 @@
gettime = time.time
-
optspec = """
burnin-flash [options...] /path/to/write/to
--
@@ -38,7 +35,7 @@
def main():
o = options.Options(optspec)
- (opt, flags, extra) = o.parse(sys.argv[1:]) #pylint: disable-msg=W0612
+ (opt, flags, extra) = o.parse(sys.argv[1:]) # pylint: disable=W0612
if not opt.mtd:
o.fatal('an mtd argument is required')
if len(extra) != 1:
@@ -95,7 +92,7 @@
ecc = py_mtd.eccstats(opt.mtd)
# Ignore ecc.corrected, they are uncommon but normal.
- print('%s: Corrected ECC error = %d' % (opt.mtd, ecc.corrected))
+ print '%s: Corrected ECC error = %d' % (opt.mtd, ecc.corrected)
if ecc.failed != start_ecc.failed:
print('%s: Uncorrectable ECC error during test, %d != %d' %
(opt.mtd, ecc.failed, start_ecc.failed))
diff --git a/cmds/dialcheck-test-server.py b/cmds/dialcheck-test-server.py
index 2637384..6f360a1 100644
--- a/cmds/dialcheck-test-server.py
+++ b/cmds/dialcheck-test-server.py
@@ -1,14 +1,11 @@
#!/usr/bin/python
-"""Fake SSDP server for unit tests.
-
-"""
+"""Fake SSDP server for unit tests."""
import errno
import os
import signal
import socket
import SocketServer
-import struct
import sys
@@ -21,6 +18,7 @@
class SSDPHandler(SocketServer.BaseRequestHandler):
+
def handle(self):
self.request[1].sendto(notify, self.client_address)
@@ -49,10 +47,11 @@
SocketServer.UDPServer.allow_reuse_address = True
s = SocketServer.UDPServer(('', 0), SSDPHandler)
s.socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
- socket.inet_aton('239.255.255.250') + socket.inet_aton('0.0.0.0'))
+ socket.inet_pton(socket.AF_INET, '239.255.255.250') +
+ socket.inet_pton(socket.AF_INET, '0.0.0.0'))
sn = s.socket.getsockname()
port = sn[1]
- open(sys.argv[1], "w").write(str(port))
+ open(sys.argv[1], 'w').write(str(port))
s.handle_request()
diff --git a/cmds/readubootver.py b/cmds/readubootver.py
index 76651be..28cc3cf 100755
--- a/cmds/readubootver.py
+++ b/cmds/readubootver.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+"""readubootver: read U-Boot version."""
import struct
import sys
@@ -19,6 +20,7 @@
def GetRootPartition():
+ """Identify the root partition from the kernel command line."""
cmdline = ReadFile(CMDLINE_FILE)
for opt in cmdline.split():
if opt.startswith('root='):
@@ -27,12 +29,13 @@
return 'kernel0'
if rootfs == 'rootfs1':
return 'kernel1'
- print 'Unknown rootfs=' + rootfs0
+ print 'Unknown rootfs=' + rootfs
sys.exit(1)
return None
def GetBootMtds():
+ """Get /dev file names for bootable MTDs."""
all_mtds = ReadFile(MTD_FILE)
boot_mtds = dict()
for line in all_mtds.split('\n'):
@@ -46,6 +49,7 @@
def ReadUbootHeader(device):
+ """Read U-Boot header from a /dev/mtd* device file."""
try:
with open(device, 'rb') as f:
chunk = f.read(7*4 + 4 + 32)
@@ -86,8 +90,8 @@
else:
print 'ALTERNATE'
print 'mtd: %s' % mtd
- print 'size: %d' % header["size"]
- print 'name: %s' % header["name"]
+ print 'size: %d' % header['size']
+ print 'name: %s' % header['name']
print ''
if __name__ == '__main__':
diff --git a/cmds/readubootver_test.py b/cmds/readubootver_test.py
index 5b13be1..e810049 100755
--- a/cmds/readubootver_test.py
+++ b/cmds/readubootver_test.py
@@ -8,12 +8,13 @@
import readubootver
+
class ReadUbootVerTest(unittest.TestCase):
def setUp(self):
self.tmp_dir = tempfile.mkdtemp()
- self.save_MTD_FILE = readubootver.MTD_FILE
- self.save_CMDLINE_FILE = readubootver.CMDLINE_FILE
+ self.save_mtd_file = readubootver.MTD_FILE
+ self.save_cmdline_file = readubootver.CMDLINE_FILE
readubootver.MTD_FILE = tempfile.mktemp(prefix=self.tmp_dir)
readubootver.CMDLINE_FILE = tempfile.mktemp(prefix=self.tmp_dir)
@@ -24,14 +25,14 @@
shutil.rmtree(self.tmp_dir)
except OSError:
pass
- readubootver.MTD_FILE = self.save_MTD_FILE
- readubootver.CMDLINE_FILE = self.save_CMDLINE_FILE
+ readubootver.MTD_FILE = self.save_mtd_file
+ readubootver.CMDLINE_FILE = self.save_cmdline_file
def testGetRootPartition(self):
with open(readubootver.CMDLINE_FILE, 'w') as f:
- f.write('ttyS0,115200 mtdparts=spi_flash:768k(loader),256k(env),' +
- '128k(var1),128k(var2),128k(sysvar1),128k(sysvar2),' +
- '14m(kernel0),14m(kernel1),-(user_data) debug=1 root=rootfs0 ' +
+ f.write('ttyS0,115200 mtdparts=spi_flash:768k(loader),256k(env),'
+ '128k(var1),128k(var2),128k(sysvar1),128k(sysvar2),'
+ '14m(kernel0),14m(kernel1),-(user_data) debug=1 root=rootfs0 '
'console=ttyS0,115200 log_buf_len=1048576')
part = readubootver.GetRootPartition()
self.assertEqual('kernel0', part)
@@ -46,18 +47,17 @@
part = readubootver.GetRootPartition()
self.assertEqual('kernel0', part)
-
def testGetBootMtds(self):
with open(readubootver.MTD_FILE, 'w') as f:
- f.write('dev: size erasesize name\n' +
- 'mtd0: 000c0000 00010000 "loader"\n' +
- 'mtd1: 00040000 00010000 "env"\n' +
- 'mtd2: 00020000 00010000 "var1"\n' +
- 'mtd3: 00020000 00010000 "var2"\n' +
- 'mtd4: 00020000 00010000 "sysvar1"\n' +
- 'mtd5: 00020000 00010000 "sysvar2"\n' +
- 'mtd6: 00e00000 00010000 "kernel0"\n' +
- 'mtd7: 00e00000 00010000 "kernel1"\n' +
+ f.write('dev: size erasesize name\n'
+ 'mtd0: 000c0000 00010000 "loader"\n'
+ 'mtd1: 00040000 00010000 "env"\n'
+ 'mtd2: 00020000 00010000 "var1"\n'
+ 'mtd3: 00020000 00010000 "var2"\n'
+ 'mtd4: 00020000 00010000 "sysvar1"\n'
+ 'mtd5: 00020000 00010000 "sysvar2"\n'
+ 'mtd6: 00e00000 00010000 "kernel0"\n'
+ 'mtd7: 00e00000 00010000 "kernel1"\n'
'mtd8: 00280000 00010000 "user_data"\n')
mtds = readubootver.GetBootMtds()
self.assertEqual(2, len(mtds))
@@ -67,20 +67,19 @@
self.assertEqual('mtd7', mtds['kernel1'])
with open(readubootver.MTD_FILE, 'w') as f:
- f.write('dev: size erasesize name\n' +
- 'mtd0: 000c0000 00010000 "loader"\n' +
- 'mtd1: 00040000 00010000 "env"\n' +
- 'mtd2: 00020000 00010000 "var1"\n' +
- 'mtd3: 00020000 00010000 "var2"\n' +
- 'mtd4: 00020000 00010000 "sysvar1"\n' +
- 'mtd5: 00020000 00010000 "sysvar2"\n' +
+ f.write('dev: size erasesize name\n'
+ 'mtd0: 000c0000 00010000 "loader"\n'
+ 'mtd1: 00040000 00010000 "env"\n'
+ 'mtd2: 00020000 00010000 "var1"\n'
+ 'mtd3: 00020000 00010000 "var2"\n'
+ 'mtd4: 00020000 00010000 "sysvar1"\n'
+ 'mtd5: 00020000 00010000 "sysvar2"\n'
'mtd166: 00e00000 00010000 "kernel0"\n')
mtds = readubootver.GetBootMtds()
self.assertEqual(1, len(mtds))
self.assertTrue('kernel0' in mtds)
self.assertEqual('mtd166', mtds['kernel0'])
-
def testReadUbootHeader(self):
data = (0x27051956, 0xdeadf00d, 0x123, 0x1234, 10, 10, 0xf00d,
0, 0, 0, 0, 'version123')
diff --git a/cmds/soft_rc.py b/cmds/soft_rc.py
index 685a069..37e628d 100755
--- a/cmds/soft_rc.py
+++ b/cmds/soft_rc.py
@@ -412,6 +412,16 @@
raise
def SendKeyCode(self, token, keycode):
+ """Send key codes to the device.
+
+ If self.autorelease is True, automatically generate a key-up event a short
+ time after each key-down event is sent.
+
+ Args:
+ token: a token for a single key event from the program's input.
+ keycode: the keycode corresponding to this token.
+ """
+
self.Log(LOG_VERB, "Enter: %r -> 0x%x" % (token, keycode))
self.WriteKeyCodeToDevice(keycode)
diff --git a/cmds/ssdptax-test-server.py b/cmds/ssdptax-test-server.py
index c86283a..de745cb 100644
--- a/cmds/ssdptax-test-server.py
+++ b/cmds/ssdptax-test-server.py
@@ -1,7 +1,5 @@
#!/usr/bin/python
-"""Fake minissdpd for unit tests.
-
-"""
+"""Fake minissdpd for unit tests."""
import BaseHTTPServer
import socket
@@ -51,11 +49,11 @@
class HttpHandler(BaseHTTPServer.BaseHTTPRequestHandler):
- """Respond to an HHTP GET for SSDP DeviceInfo."""
- def do_GET(self):
+ def do_GET(self): # pylint: disable=invalid-name
+ """Respond to an HTTP GET for SSDP DeviceInfo."""
self.send_response(200)
- self.send_header('Content-type','text/xml')
+ self.send_header('Content-type', 'text/xml')
self.end_headers()
if self.path.endswith('text_device_xml'):
self.wfile.write(text_device_xml)
@@ -67,7 +65,8 @@
self.wfile.write(ssdp_device_xml)
-class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
+class ThreadingHTTPServer(SocketServer.ThreadingMixIn,
+ BaseHTTPServer.HTTPServer):
pass
@@ -85,6 +84,7 @@
class UdpHandler(SocketServer.DatagramRequestHandler):
+
def handle(self):
self.request[1].sendto(bytearray(notify_text[0]), self.client_address)
@@ -105,7 +105,7 @@
if testnum == 4:
pathend = 'ssdp_device_xml'
- h = ThreadingHTTPServer(("", 0), HttpHandler)
+ h = ThreadingHTTPServer(('', 0), HttpHandler)
sn = h.socket.getsockname()
port = sn[1]
url = 'http://127.0.0.1:%d/%s' % (port, pathend)
@@ -126,7 +126,8 @@
d = ThreadingUdpServer(('', 1900), UdpHandler)
d.socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
- socket.inet_aton('239.255.255.250') + socket.inet_aton('0.0.0.0'))
+ socket.inet_pton(socket.AF_INET, '239.255.255.250') +
+ socket.inet_pton(socket.AF_INET, '0.0.0.0'))
d_thread = threading.Thread(target=d.serve_forever)
d_thread.daemon = True
d_thread.start()
diff --git a/cmds/stun.py b/cmds/stun.py
index 5b162ef..94b45a3 100755
--- a/cmds/stun.py
+++ b/cmds/stun.py
@@ -99,7 +99,7 @@
try:
- import monotime # pylint: disable-msg=unused-import,g-import-not-at-top
+ import monotime # pylint: disable=unused-import,g-import-not-at-top
except ImportError:
pass
try:
@@ -130,9 +130,9 @@
family, port = struct.unpack('!HH', value[:4])
addr = value[4:]
if family == 0x01: # IPv4
- return socket.inet_ntoa(addr), port
+ return socket.inet_ntop(socket.AF_INET, addr), port
elif family == 0x02: # IPv6
- return socket.inet_ntop(socket.AF_INET6), port
+ return socket.inet_ntop(socket.AF_INET6, addr), port
else:
raise ValueError('invalid family %d: expected 1=IPv4 or 2=IPv6' % family)
@@ -166,6 +166,7 @@
def _Encode(msgtype, transaction_id, *attrs):
+ """Encode message type, transaction id, and attrs into a STUN message."""
transaction_id = str(transaction_id)
if len(transaction_id) != 12:
raise ValueError('transactionid %r must be exactly 12 bytes'
@@ -179,6 +180,7 @@
def _Decode(text):
+ """Decode a STUN message into message type, transaction id, and attrs."""
if len(text) < 20:
raise ParseError('packet length %d must be >= 20' % len(text))
msgtype, length, cookie = struct.unpack('!HHI', text[:8])
diff --git a/cmds/test-logos.py b/cmds/test-logos.py
index 34f5693..186ea24 100755
--- a/cmds/test-logos.py
+++ b/cmds/test-logos.py
@@ -2,17 +2,23 @@
"""Tests for the logos program."""
-import random
+import os
import select
import signal
import socket
import subprocess
-import time
-from wvtest.wvtest import *
+
+from wvtest.wvtest import WVFAIL
+from wvtest.wvtest import WVPASS
+from wvtest.wvtest import WVPASSEQ
+from wvtest.wvtest import WVPASSLT
+from wvtest.wvtest import wvtest
+from wvtest.wvtest import wvtest_main
@wvtest
-def testLogos():
+def TestLogos():
+ """spin up and test a logos server."""
# We use a SOCK_DGRAM here rather than a normal pipe, because datagram
# sockets are guaranteed never to merge consecutive writes into a single
# packet. That way we can validate the correct merging of write() calls
@@ -30,7 +36,7 @@
fd2 = sock2.fileno()
def _Read():
- r, w, x = select.select([fd2, pipe1], [], [], 30)
+ r, unused_w, unused_x = select.select([fd2, pipe1], [], [], 30)
if pipe1 in r:
WVFAIL('subprocess died unexpectedly')
raise Exception('subprocess died unexpectedly with code %d' % p.wait())
@@ -42,7 +48,7 @@
os.write(fd1, 'a\nErROR: b\nw: c')
WVPASSEQ('<7>fac: a\n', _Read())
WVPASSEQ('<3>fac: ErROR: b\n', _Read())
- r, w, x = select.select([fd2], [], [], 0)
+ r, unused_w, unused_x = select.select([fd2], [], [], 0)
WVFAIL(r)
os.write(fd1, '\n\n')
WVPASSEQ('<4>fac: w: c\n', _Read())
@@ -54,13 +60,13 @@
WVPASSEQ('<7>fac: abba bbb\n', _Read())
WVPASSEQ('<7>fac: aa b c\n', _Read())
os.write(fd1, ''.join(chr(i) for i in range(33)) + '\n')
- WVPASSEQ(r'<7>fac: ' +
+ WVPASSEQ(r'<7>fac: '
r'\x00\x01\x02\x03\x04\x05\x06\x07\x08 '
- + '\n', _Read())
- WVPASSEQ(r'<7>fac: ' +
- r'\x0b\x0c\x0e\x0f' +
- r'\x10\x11\x12\x13\x14\x15\x16\x17' +
- r'\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ' +
+ '\n', _Read())
+ WVPASSEQ(r'<7>fac: '
+ r'\x0b\x0c\x0e\x0f'
+ r'\x10\x11\x12\x13\x14\x15\x16\x17'
+ r'\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f '
'\n', _Read())
# very long lines should be broken, but not missing any characters
@@ -81,7 +87,7 @@
result = _Read()
print '%r' % result
WVPASS(result.startswith('<4>fac: W: '))
- r, w, x = select.select([fd2], [], [], 0)
+ r, unused_w, unused_x = select.select([fd2], [], [], 0)
WVFAIL(r)
os.write(fd1, '\n')
WVPASSEQ('<7>fac: booga!\n', _Read())
@@ -94,9 +100,8 @@
print repr(result)
print 'got: %r' % result
WVPASS('rate limiting started')
- while 1:
- # drain the input until it's idle
- r, w, x = select.select([fd1], [], [], 0.1)
+ while 1: # drain the input until it's idle
+ r, unused_w, unused_x = select.select([fd1], [], [], 0.1)
if not r:
break