Skip to content

Commit e0d86e8

Browse files
authored
Merge pull request RustPython#2706 from deantvv/os-fix-test
Fix tests in os
2 parents 0f8d954 + 62f49ed commit e0d86e8

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

Lib/test/test_os.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,15 +3630,13 @@ class PathTConverterTests(unittest.TestCase):
36303630
# function, cleanup function)
36313631
functions = [
36323632
('stat', True, (), None),
3633-
('lstat', False, (), None),
3633+
('lstat', True, (), None),
36343634
('access', False, (os.F_OK,), None),
36353635
('chflags', False, (0,), None),
36363636
('lchflags', False, (0,), None),
36373637
('open', False, (0,), getattr(os, 'close', None)),
36383638
]
36393639

3640-
# TODO: RUSTPYTHON
3641-
@unittest.expectedFailure
36423640
def test_path_t_converter(self):
36433641
str_filename = support.TESTFN
36443642
if os.name == 'nt':
@@ -3683,8 +3681,6 @@ def test_path_t_converter(self):
36833681
'os.PathLike'):
36843682
fn(fd, *extra_args)
36853683

3686-
# TODO: RUSTPYTHON
3687-
@unittest.expectedFailure
36883684
def test_path_t_converter_and_custom_class(self):
36893685
msg = r'__fspath__\(\) to return str or bytes, not %s'
36903686
with self.assertRaisesRegex(TypeError, msg % r'int'):

vm/src/stdlib/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ fn fspath(obj: PyObjectRef, check_for_nul: bool, vm: &VirtualMachine) -> PyResul
158158
}
159159
let method = vm.get_method_or_type_error(obj.clone(), "__fspath__", || {
160160
format!(
161-
"expected str, bytes or os.PathLike object, not '{}'",
161+
"expected str, bytes or os.PathLike object, not {}",
162162
obj.class().name
163163
)
164164
})?;
165165
let result = vm.invoke(&method, ())?;
166166
match1(&result)?.ok_or_else(|| {
167167
vm.new_type_error(format!(
168-
"expected {}.__fspath__() to return str or bytes, not '{}'",
168+
"expected {}.__fspath__() to return str or bytes, not {}",
169169
obj.class().name,
170170
result.class().name,
171171
))

0 commit comments

Comments
 (0)