diff --git a/scrapy/utils/benchserver.py b/scrapy/utils/benchserver.py
index 4385d72a9..a9a2c938e 100644
--- a/scrapy/utils/benchserver.py
+++ b/scrapy/utils/benchserver.py
@@ -16,15 +16,15 @@ class Root(Resource):
total = _getarg(request, 'total', 100, int)
show = _getarg(request, 'show', 10, int)
nlist = [random.randint(1, total) for _ in range(show)]
- request.write("
")
+ request.write(b"")
args = request.args.copy()
for nl in nlist:
args['n'] = nl
argstr = urlencode(args, doseq=True)
request.write("follow {1}
"
- .format(argstr, nl))
- request.write("")
- return ''
+ .format(argstr, nl).encode('utf8'))
+ request.write(b"")
+ return b''
def _getarg(request, name, default=None, type=str):
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 5755b3881..057112d12 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -72,7 +72,7 @@ class StartprojectTest(ProjectTest):
self.assertEqual(1, self.call('startproject', self.project_name))
self.assertEqual(1, self.call('startproject', 'wrong---project---name'))
self.assertEqual(1, self.call('startproject', 'sys'))
-
+
class StartprojectTemplatesTest(ProjectTest):
@@ -80,7 +80,7 @@ class StartprojectTemplatesTest(ProjectTest):
super(StartprojectTemplatesTest, self).setUp()
self.tmpl = join(self.temp_path, 'templates')
self.tmpl_proj = join(self.tmpl, 'project')
-
+
def test_startproject_template_override(self):
copytree(join(scrapy.__path__[0], 'templates'), self.tmpl)
os.mknod(join(self.tmpl_proj, 'root_template'))
@@ -276,3 +276,4 @@ class BenchCommandTest(CommandTest):
'-s', 'CLOSESPIDER_TIMEOUT=0.01')
log = to_native_str(p.stderr.read())
self.assertIn('INFO: Crawled', log)
+ self.assertNotIn('Unhandled Error', log)