Skip to content

Commit e42186d

Browse files
Alex Marchpfalcon
Alex March
authored andcommitted
tests/extmod/vfs_fat: Replace asserts with prints and expected outputs.
1 parent f2f8ae1 commit e42186d

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

tests/extmod/vfs_fat_ramdisk.py

+13-15
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def ioctl(self, op, arg):
4141

4242
uos.VfsFat.mkfs(bdev)
4343

44-
assert b"FOO_FILETXT" not in bdev.data
45-
assert b"hello!" not in bdev.data
44+
print(b"FOO_FILETXT" not in bdev.data)
45+
print(b"hello!" not in bdev.data)
4646

4747
vfs = uos.VfsFat(bdev, "/ramdisk")
4848
print("statvfs:", vfs.statvfs("/ramdisk"))
@@ -57,21 +57,21 @@ def ioctl(self, op, arg):
5757
print(f2.read())
5858
f2.close()
5959

60-
assert b"FOO_FILETXT" in bdev.data
61-
assert b"hello!" in bdev.data
60+
print(b"FOO_FILETXT" in bdev.data)
61+
print(b"hello!" in bdev.data)
6262

63-
assert vfs.listdir() == ['foo_file.txt']
63+
print(vfs.listdir())
6464

6565
try:
6666
vfs.rmdir("foo_file.txt")
6767
except OSError as e:
6868
print(e.args[0] == 20) # uerrno.ENOTDIR
6969

7070
vfs.remove('foo_file.txt')
71-
assert vfs.listdir() == []
71+
print(vfs.listdir())
7272

7373
vfs.mkdir("foo_dir")
74-
assert vfs.listdir() == ['foo_dir']
74+
print(vfs.listdir())
7575

7676
try:
7777
vfs.remove("foo_dir")
@@ -82,18 +82,18 @@ def ioctl(self, op, arg):
8282
f.write("data in file")
8383
f.close()
8484

85-
assert vfs.listdir("foo_dir") == ['file-in-dir.txt']
85+
print(vfs.listdir("foo_dir"))
8686

8787
vfs.rename("foo_dir/file-in-dir.txt", "moved-to-root.txt")
88-
assert vfs.listdir() == ['foo_dir', 'moved-to-root.txt']
88+
print(vfs.listdir())
8989

9090
vfs.chdir("foo_dir")
9191
print("getcwd:", vfs.getcwd())
92-
assert vfs.listdir() == []
92+
print(vfs.listdir())
9393

9494
with vfs.open("sub_file.txt", "w") as f:
9595
f.write("test2")
96-
assert vfs.listdir() == ["sub_file.txt"]
96+
print(vfs.listdir())
9797

9898
try:
9999
vfs.chdir("sub_file.txt")
@@ -116,9 +116,7 @@ def ioctl(self, op, arg):
116116
try:
117117
vfs.listdir()
118118
except OSError as e:
119-
assert e.args[0] == uerrno.ENODEV
120-
else:
121-
raise AssertionError("expected OSError not thrown")
119+
print(e.args[0] == uerrno.ENODEV)
122120

123121
vfs = uos.VfsFat(bdev, "/ramdisk")
124-
assert vfs.listdir() == ['moved-to-root.txt']
122+
print(vfs.listdir())

tests/extmod/vfs_fat_ramdisk.py.exp

+13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
True
2+
True
13
statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
24
getcwd: /ramdisk
35
hello!
46
True
57
True
8+
['foo_file.txt']
9+
True
10+
[]
11+
['foo_dir']
12+
True
13+
['file-in-dir.txt']
14+
['foo_dir', 'moved-to-root.txt']
615
getcwd: /ramdisk/foo_dir
16+
[]
17+
['sub_file.txt']
718
True
819
getcwd: /ramdisk
920
True
1021
['moved-to-root.txt']
22+
True
23+
['moved-to-root.txt']

0 commit comments

Comments
 (0)