[Python-checkins] distutils2: Minor style tweaks (whitespace, imports, methods)
tarek.ziade
python-checkins at python.org
Sun Jul 4 11:48:40 CEST 2010
tarek.ziade pushed 2832841bf47c to distutils2:
http://hg.python.org/distutils2/rev/2832841bf47c
changeset: 322:2832841bf47c
parent: 320:1b75f9a8dd54
user: ?ric Araujo <merwok at netwok.org>
date: Sun Jun 27 01:30:13 2010 +0200
summary: Minor style tweaks (whitespace, imports, methods)
files: src/distutils2/tests/pypi_server.py, src/distutils2/tests/test_pypi_dist.py, src/distutils2/tests/test_pypi_server.py
diff --git a/src/distutils2/tests/pypi_server.py b/src/distutils2/tests/pypi_server.py
--- a/src/distutils2/tests/pypi_server.py
+++ b/src/distutils2/tests/pypi_server.py
@@ -29,7 +29,7 @@
func(server=server, *args, **kwargs)
server.stop()
return wrapped
- return wrapper
+ return wrapper
class PyPIServerTestCase(unittest.TestCase):
@@ -50,7 +50,7 @@
"""
def __init__(self, test_static_path=None,
- static_filesystem_paths=["default"], static_uri_paths=["simple"]):
+ static_filesystem_paths=["default"], static_uri_paths=["simple"]):
"""Initialize the server.
static_uri_paths and static_base_path are parameters used to provides
@@ -59,7 +59,7 @@
"""
threading.Thread.__init__(self)
self._run = True
- self.httpd = HTTPServer(('', 0), PyPIRequestHandler)
+ self.httpd = HTTPServer(('', 0), PyPIRequestHandler)
self.httpd.RequestHandlerClass.log_request = lambda *_: None
self.httpd.RequestHandlerClass.pypi_server = self
self.address = (self.httpd.server_name, self.httpd.server_port)
@@ -131,7 +131,7 @@
"""
# record the request. Read the input only on PUT or POST requests
if self.command in ("PUT", "POST"):
- if self.headers.dict.has_key("content-length"):
+ if 'content-length' in self.headers.dict:
request_data = self.rfile.read(
int(self.headers['content-length']))
else:
@@ -175,8 +175,8 @@
status, headers, data = self.pypi_server.get_next_response()
self.make_response(data, status, headers)
- def make_response(self, data, status=200,
- headers=[('Content-type', 'text/html')]):
+ def make_response(self, data, status=200,
+ headers=[('Content-type', 'text/html')]):
"""Send the response to the HTTP client"""
if not isinstance(status, int):
try:
@@ -184,7 +184,7 @@
except ValueError:
# we probably got something like YYY Codename.
# Just get the first 3 digits
- status = int(status[:3])
+ status = int(status[:3])
self.send_response(status)
for header, value in headers:
diff --git a/src/distutils2/tests/test_pypi_dist.py b/src/distutils2/tests/test_pypi_dist.py
--- a/src/distutils2/tests/test_pypi_dist.py
+++ b/src/distutils2/tests/test_pypi_dist.py
@@ -1,16 +1,16 @@
-"""Tests for the distutils2.pypi.dist module.
-"""
+"""Tests for the distutils2.pypi.dist module."""
+
+import os
+import shutil
+import tempfile
from distutils2.tests.pypi_server import use_pypi_server
from distutils2.tests.support import unittest
from distutils2.version import VersionPredicate
from distutils2.pypi.errors import MD5HashDoesNotMatch
-from distutils2.pypi.dist import PyPIDistribution as Dist, \
- PyPIDistributions as Dists, split_archive_name
-
-import tempfile
-import os
-import shutil
+from distutils2.pypi.dist import (PyPIDistribution as Dist,
+ PyPIDistributions as Dists,
+ split_archive_name)
class TestPyPIDistribution(unittest.TestCase):
diff --git a/src/distutils2/tests/test_pypi_server.py b/src/distutils2/tests/test_pypi_server.py
--- a/src/distutils2/tests/test_pypi_server.py
+++ b/src/distutils2/tests/test_pypi_server.py
@@ -23,9 +23,9 @@
self.assertEqual(len(server.requests), 1)
handler, request_data = server.requests[-1]
self.assertIn("Rock Around The Bunker", request_data)
- self.assertTrue(handler.headers.dict.has_key("x-test-header"))
- self.assertEqual(handler.headers.dict["x-test-header"],
- "Mister Iceberg")
+ self.assertIn("x-test-header", handler.headers.dict)
+ self.assertEqual(handler.headers.dict["x-test-header"],
+ "Mister Iceberg")
server.stop()
def test_serve_static_content(self):
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list