Kaydet (Commit) 6d2e3f4d authored tarafından Ezio Melotti's avatar Ezio Melotti

Merged revisions 78272 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78272 | ezio.melotti | 2010-02-21 00:34:21 +0200 (Sun, 21 Feb 2010) | 1 line

  skip tests with a non-ascii cwd when the file system encoding is ascii
........
üst 1fa91165
import os import os
import sys
import macpath import macpath
from test import test_support from test import test_support
import unittest import unittest
...@@ -12,7 +13,13 @@ class MacPathTestCase(unittest.TestCase): ...@@ -12,7 +13,13 @@ class MacPathTestCase(unittest.TestCase):
# Issue 3426: check that abspath retuns unicode when the arg is unicode # Issue 3426: check that abspath retuns unicode when the arg is unicode
# and str when it's str, with both ASCII and non-ASCII cwds # and str when it's str, with both ASCII and non-ASCII cwds
saved_cwd = os.getcwd() saved_cwd = os.getcwd()
for cwd in (u'cwd', u'\xe7w\xf0'): cwds = ['cwd']
try:
cwds.append(u'\xe7w\xf0'.encode(sys.getfilesystemencoding()
or 'ascii'))
except UnicodeEncodeError:
pass # the cwd can't be encoded -- test with ascii cwd only
for cwd in cwds:
try: try:
os.mkdir(cwd) os.mkdir(cwd)
os.chdir(cwd) os.chdir(cwd)
......
import unittest import unittest
from test import test_support from test import test_support
import posixpath, os import posixpath, os, sys
from posixpath import realpath, abspath, dirname, basename from posixpath import realpath, abspath, dirname, basename
# An absolute path to a temporary filename for testing. We can't rely on TESTFN # An absolute path to a temporary filename for testing. We can't rely on TESTFN
...@@ -393,7 +393,13 @@ class PosixPathTest(unittest.TestCase): ...@@ -393,7 +393,13 @@ class PosixPathTest(unittest.TestCase):
# Issue 3426: check that abspath retuns unicode when the arg is unicode # Issue 3426: check that abspath retuns unicode when the arg is unicode
# and str when it's str, with both ASCII and non-ASCII cwds # and str when it's str, with both ASCII and non-ASCII cwds
saved_cwd = os.getcwd() saved_cwd = os.getcwd()
for cwd in (u'cwd', u'\xe7w\xf0'): cwds = ['cwd']
try:
cwds.append(u'\xe7w\xf0'.encode(sys.getfilesystemencoding()
or 'ascii'))
except UnicodeEncodeError:
pass # the cwd can't be encoded -- test with ascii cwd only
for cwd in cwds:
try: try:
os.mkdir(cwd) os.mkdir(cwd)
os.chdir(cwd) os.chdir(cwd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment