2
2
import unittest
3
3
from collections import UserDict
4
4
from test .support import import_helper
5
- from test .support .os_helper import unlink , TESTFN , TESTFN_UNDECODABLE
5
+ from test .support .os_helper import unlink , TESTFN , TESTFN_ASCII , TESTFN_UNDECODABLE
6
6
7
7
NULL = None
8
8
_testcapi = import_helper .import_module ('_testcapi' )
@@ -35,6 +35,7 @@ class CAPITest(unittest.TestCase):
35
35
36
36
def test_run_stringflags (self ):
37
37
# Test PyRun_StringFlags().
38
+ # XXX: fopen() uses different path encoding than Python on Windows.
38
39
def run (s , * args ):
39
40
return _testcapi .run_stringflags (s , Py_file_input , * args )
40
41
source = b'a\n '
@@ -63,7 +64,7 @@ def run(s, *args):
63
64
64
65
def test_run_fileexflags (self ):
65
66
# Test PyRun_FileExFlags().
66
- filename = os .fsencode (TESTFN )
67
+ filename = os .fsencode (TESTFN if os . name != 'nt' else TESTFN_ASCII )
67
68
with open (filename , 'wb' ) as fp :
68
69
fp .write (b'a\n ' )
69
70
self .addCleanup (unlink , filename )
@@ -89,6 +90,7 @@ def run(*args):
89
90
# CRASHES run(UserDict(), dict(a=1))
90
91
91
92
@unittest .skipUnless (TESTFN_UNDECODABLE , 'only works if there are undecodable paths' )
93
+ @unittest .skipIf (os .name == 'nt' , 'does not work on Windows' )
92
94
def test_run_fileexflags_with_undecodable_filename (self ):
93
95
run = _testcapi .run_fileexflags
94
96
try :
0 commit comments