mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Add _winapi.GetACP and enable test_unicode on windows (#5547)
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
1 parent
31c5c3eb9d
commit
1f3a9672c3
6 files changed
+6
-18
No files matched your search
@@ -22,7 +22,6 @@ env:
|
||||
# test_os: many failing tests
|
||||
# test_pathlib: support.rmtree() failing
|
||||
# test_posixpath: OSError: (22, 'The filename, directory name, or volume label syntax is incorrect. (os error 123)')
|
||||
# test_unicode: AttributeError: module '_winapi' has no attribute 'GetACP'
|
||||
# test_venv: couple of failing tests
|
||||
WINDOWS_SKIPS: >-
|
||||
test_glob
|
||||
@@ -31,7 +30,6 @@ env:
|
||||
test_rlcompleter
|
||||
test_pathlib
|
||||
test_posixpath
|
||||
test_unicode
|
||||
test_venv
|
||||
# configparser: https://github.com/RustPython/RustPython/issues/4995#issuecomment-1582397417
|
||||
# socketserver: seems related to configparser crash.
|
||||
|
||||
Vendored
-3
@@ -26,7 +26,6 @@ codecs.register(codec_search_function)
|
||||
codecname = 'testcodec'
|
||||
|
||||
class CharmapCodecTest(unittest.TestCase):
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_constructorx(self):
|
||||
self.assertEqual(str(b'abc', codecname), 'abc')
|
||||
self.assertEqual(str(b'xdef', codecname), 'abcdef')
|
||||
@@ -43,14 +42,12 @@ class CharmapCodecTest(unittest.TestCase):
|
||||
self.assertEqual('dxf'.encode(codecname), b'dabcf')
|
||||
self.assertEqual('dxfx'.encode(codecname), b'dabcfabc')
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_constructory(self):
|
||||
self.assertEqual(str(b'ydef', codecname), 'def')
|
||||
self.assertEqual(str(b'defy', codecname), 'def')
|
||||
self.assertEqual(str(b'dyf', codecname), 'df')
|
||||
self.assertEqual(str(b'dyfy', codecname), 'df')
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_maptoundefined(self):
|
||||
self.assertRaises(UnicodeError, str, b'abc\001', codecname)
|
||||
|
||||
|
||||
Vendored
-11
@@ -1827,7 +1827,6 @@ class CodecsModuleTest(unittest.TestCase):
|
||||
self.assertEqual(codecs.decode(b'[\xff]', 'ascii', errors='ignore'),
|
||||
'[]')
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_encode(self):
|
||||
self.assertEqual(codecs.encode('\xe4\xf6\xfc', 'latin-1'),
|
||||
b'\xe4\xf6\xfc')
|
||||
@@ -1846,7 +1845,6 @@ class CodecsModuleTest(unittest.TestCase):
|
||||
self.assertRaises(TypeError, codecs.register)
|
||||
self.assertRaises(TypeError, codecs.register, 42)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AttributeError: module '_winapi' has no attribute 'GetACP'")
|
||||
def test_unregister(self):
|
||||
name = "nonexistent_codec_name"
|
||||
search_function = mock.Mock()
|
||||
@@ -1859,28 +1857,23 @@ class CodecsModuleTest(unittest.TestCase):
|
||||
self.assertRaises(LookupError, codecs.lookup, name)
|
||||
search_function.assert_not_called()
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_lookup(self):
|
||||
self.assertRaises(TypeError, codecs.lookup)
|
||||
self.assertRaises(LookupError, codecs.lookup, "__spam__")
|
||||
self.assertRaises(LookupError, codecs.lookup, " ")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_getencoder(self):
|
||||
self.assertRaises(TypeError, codecs.getencoder)
|
||||
self.assertRaises(LookupError, codecs.getencoder, "__spam__")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_getdecoder(self):
|
||||
self.assertRaises(TypeError, codecs.getdecoder)
|
||||
self.assertRaises(LookupError, codecs.getdecoder, "__spam__")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_getreader(self):
|
||||
self.assertRaises(TypeError, codecs.getreader)
|
||||
self.assertRaises(LookupError, codecs.getreader, "__spam__")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_getwriter(self):
|
||||
self.assertRaises(TypeError, codecs.getwriter)
|
||||
self.assertRaises(LookupError, codecs.getwriter, "__spam__")
|
||||
@@ -1939,7 +1932,6 @@ class CodecsModuleTest(unittest.TestCase):
|
||||
self.assertRaises(UnicodeError,
|
||||
codecs.decode, b'abc', 'undefined', errors)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_file_closes_if_lookup_error_raised(self):
|
||||
mock_open = mock.mock_open()
|
||||
with mock.patch('builtins.open', mock_open) as file:
|
||||
@@ -3287,7 +3279,6 @@ class ExceptionNotesTest(unittest.TestCase):
|
||||
self.check_note(RuntimeError('a', 'b', 'c'), msg_re)
|
||||
|
||||
# http://bugs.python.org/issue19609
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_codec_lookup_failure(self):
|
||||
msg = "^unknown encoding: {}$".format(self.codec_name)
|
||||
with self.assertRaisesRegex(LookupError, msg):
|
||||
@@ -3523,8 +3514,6 @@ class CodePageTest(unittest.TestCase):
|
||||
False)
|
||||
self.assertEqual(decoded, ('abc', 3))
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_mbcs_alias(self):
|
||||
# Check that looking up our 'default' codepage will return
|
||||
# mbcs when we don't have a more specific one available
|
||||
|
||||
Vendored
-2
@@ -1237,7 +1237,6 @@ class TestDetectEncoding(TestCase):
|
||||
found, consumed_lines = detect_encoding(rl)
|
||||
self.assertEqual(found, "utf-8")
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_short_files(self):
|
||||
readline = self.get_readline((b'print(something)\n',))
|
||||
encoding, consumed_lines = detect_encoding(readline)
|
||||
@@ -1316,7 +1315,6 @@ class TestDetectEncoding(TestCase):
|
||||
ins = Bunk(lines, path)
|
||||
detect_encoding(ins.readline)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_open_error(self):
|
||||
# Issue #23840: open() must close the binary file on error
|
||||
m = BytesIO(b'#coding:xxx')
|
||||
|
||||
@@ -125,6 +125,7 @@ features = [
|
||||
workspace = true
|
||||
features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_Globalization",
|
||||
"Win32_Networking_WinSock",
|
||||
"Win32_Security",
|
||||
"Win32_Storage_FileSystem",
|
||||
|
||||
@@ -119,6 +119,11 @@ mod _winapi {
|
||||
Ok(HANDLE(target))
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn GetACP() -> u32 {
|
||||
unsafe { windows_sys::Win32::Globalization::GetACP() }
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn GetCurrentProcess() -> HANDLE {
|
||||
unsafe { windows::Win32::System::Threading::GetCurrentProcess() }
|
||||
|
||||
Reference in new issue
Block a user