Package: pydicom / 0.9.9-2

changeset_d8bd28c7810f97af45f234b1016be31ca2d42382.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
commit d8bd28c7810f97af45f234b1016be31ca2d42382
Author: Yaroslav Halchenko <debian@onerussian.com>
Date:   Sat Jan 17 00:15:48 2015 -0500

    BF: do not force unicode names when not supported

diff --git a/source/dicom/test/test_unicode.py b/source/dicom/test/test_unicode.py
index 2ea2dfa..05d4af3 100644
--- a/source/dicom/test/test_unicode.py
+++ b/source/dicom/test/test_unicode.py
@@ -2,6 +2,7 @@
 # -*- coding: utf-8 -*-
 
 import dicom
+import sys
 import unittest
 
 
@@ -9,6 +10,14 @@ class UnicodeFilenames(unittest.TestCase):
     def testRead(self):
         """Unicode: Can read a file with unicode characters in name................"""
         uni_name = u'test°'
+
+        # verify first that we could encode file name in this environment
+        try:
+            _ = uni_name.encode(sys.getfilesystemencoding())
+        except UnicodeEncodeError:
+            print("SKIP: Environment doesn't support unicode filenames")
+            return
+
         try:
             dicom.read_file(uni_name)
         except UnicodeEncodeError: