Brench merge

This commit is contained in:
Éric Araujo 2011-08-12 17:59:25 +02:00
commit 14eba5fa41
8 changed files with 34 additions and 37 deletions

View file

@ -10,7 +10,7 @@ from distutils.core import Distribution
from distutils.errors import DistutilsFileError
from distutils.tests import support
from test.support import run_unittest, create_empty_file
from test.support import run_unittest
class BuildPyTestCase(support.TempdirManager,
@ -71,11 +71,11 @@ class BuildPyTestCase(support.TempdirManager,
# create the distribution files.
sources = self.mkdtemp()
create_empty_file(os.path.join(sources, "__init__.py"))
open(os.path.join(sources, "__init__.py"), "w").close()
testdir = os.path.join(sources, "doc")
os.mkdir(testdir)
create_empty_file(os.path.join(testdir, "testfile"))
open(os.path.join(testdir, "testfile"), "w").close()
os.chdir(sources)
old_stdout = sys.stdout

View file

@ -3,18 +3,14 @@
from packaging.pypi.xmlrpc import Client, InvalidSearchField, ProjectNotFound
from packaging.tests import unittest
from packaging.tests.support import fake_dec
try:
import threading
from packaging.tests.pypi_server import use_xmlrpc_server
except ImportError:
threading = None
def use_xmlrpc_server():
def _use(func):
def __use(*args, **kw):
return func(*args, **kw)
return __use
return _use
use_xmlrpc_server = fake_dec
@unittest.skipIf(threading is None, "Needs threading")

View file

@ -276,7 +276,7 @@ def split(s, comments=False, posix=True):
return list(lex)
_find_unsafe = re.compile(r'[^\w\d@%_\-\+=:,\./]').search
_find_unsafe = re.compile(r'[^\w@%\-\+=:,\./]', re.ASCII).search
def quote(s):
"""Return a shell-escaped version of the string *s*."""

View file

@ -267,7 +267,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
names = []
try:
names = os.listdir(path)
except os.error as err:
except os.error:
onerror(os.listdir, path, sys.exc_info())
for name in names:
fullname = os.path.join(path, name)
@ -280,7 +280,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
else:
try:
os.remove(fullname)
except os.error as err:
except os.error:
onerror(os.remove, fullname, sys.exc_info())
try:
os.rmdir(path)
@ -323,7 +323,7 @@ def move(src, dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
except OSError as exc:
except OSError:
if os.path.isdir(src):
if _destinsrc(src, dst):
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))

View file

@ -176,7 +176,8 @@ class ShlexTest(unittest.TestCase):
def testQuote(self):
safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./'
unsafe = '"`$\\!'
unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s
unsafe = '"`$\\!' + unicode_sample
self.assertEqual(shlex.quote(''), "''")
self.assertEqual(shlex.quote(safeunquoted), safeunquoted)