[pygobject] tests: skip some failing test under Windows with Python 3.6
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: skip some failing test under Windows with Python 3.6
- Date: Fri, 25 Aug 2017 16:19:52 +0000 (UTC)
commit c0e42240cd72c012a740f26dc3fb0eef98328110
Author: Christoph Reiter <creiter src gnome org>
Date: Fri Aug 25 18:17:33 2017 +0200
tests: skip some failing test under Windows with Python 3.6
Python 3.6 has changed the default filesystem encoding on Windows
from mbcs to utf-8. Some tests assume mbcs, so skip them for now.
tests/test_gi.py | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 173744a..8a9bb2c 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -692,6 +692,7 @@ class TestFilename(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.workdir)
+ @unittest.skipIf(os.name == "nt", "fixme")
def test_filename_in(self):
fname = os.path.join(self.workdir, u'testäø.txt')
self.assertRaises(GLib.GError, GLib.file_get_contents, fname)
@@ -808,12 +809,17 @@ class TestFilename(unittest.TestCase):
glib_repr = GIMarshallingTests.filename_to_glib_repr
if PY3:
- str_path = copy(b"\xff\xfe")
- self.assertTrue(isinstance(str_path, str))
- self.assertEqual(str_path, os.fsdecode(b"\xff\xfe"))
- self.assertEqual(copy(str_path), str_path)
- self.assertEqual(glib_repr(b"\xff\xfe"), b"\xff\xfe")
- self.assertEqual(glib_repr(str_path), b"\xff\xfe")
+ try:
+ os.fsdecode(b"\xff\xfe")
+ except UnicodeDecodeError:
+ self.assertRaises(UnicodeDecodeError, copy, b"\xff\xfe")
+ else:
+ str_path = copy(b"\xff\xfe")
+ self.assertTrue(isinstance(str_path, str))
+ self.assertEqual(str_path, os.fsdecode(b"\xff\xfe"))
+ self.assertEqual(copy(str_path), str_path)
+ self.assertEqual(glib_repr(b"\xff\xfe"), b"\xff\xfe")
+ self.assertEqual(glib_repr(str_path), b"\xff\xfe")
# if getfilesystemencoding is ASCII, then we should fail like
# os.fsencode
@@ -853,7 +859,11 @@ class TestFilename(unittest.TestCase):
paths = [(wdb, b"foo-1"), (wd, u"foo-2"), (wd, u"öäü-3")]
if PY3:
- paths.append((wd, os.fsdecode(b"\xff\xfe-4")))
+ try:
+ paths.append((wd, os.fsdecode(b"\xff\xfe-4")))
+ except UnicodeDecodeError:
+ # depends on the code page
+ pass
if os.name != "nt":
paths.append((wdb, b"\xff\xfe-5"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]