From e4e5d75df7944c885c3b3eba4e2903429b137f89 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 28 Jul 2025 22:47:16 +0200 Subject: [PATCH] tests: Fix mypy, Windows test failures --- tests/showbase/test_VFSImporter.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/showbase/test_VFSImporter.py b/tests/showbase/test_VFSImporter.py index 33c1c6a186..52ce6c3206 100644 --- a/tests/showbase/test_VFSImporter.py +++ b/tests/showbase/test_VFSImporter.py @@ -1,4 +1,4 @@ -from panda3d.core import VirtualFileSystem, VirtualFileMountRamdisk +from panda3d.core import VirtualFileSystem, VirtualFileMountRamdisk, Filename import sys @@ -25,28 +25,32 @@ def test_VFSImporter(): import testmod assert testmod.var == 1 assert testmod.__spec__.name == 'testmod' - assert testmod.__spec__.origin == '/ram/testmod.py' - assert testmod.__file__ == '/ram/testmod.py' + filename = Filename('/ram/testmod.py').to_os_specific() + assert testmod.__spec__.origin == filename + assert testmod.__file__ == filename import testpkg assert testpkg.var == 2 assert testpkg.__package__ == 'testpkg' - assert testpkg.__path__ == ['/ram/testpkg'] + assert testpkg.__path__ == [Filename('/ram/testpkg').to_os_specific()] assert testpkg.__spec__.name == 'testpkg' - assert testpkg.__spec__.origin == '/ram/testpkg/__init__.py' - assert testpkg.__file__ == '/ram/testpkg/__init__.py' + filename = Filename('/ram/testpkg/__init__.py').to_os_specific() + assert testpkg.__spec__.origin == filename + assert testpkg.__file__ == filename from testpkg import test assert test.var == 3 assert test.__spec__.name == 'testpkg.test' - assert test.__spec__.origin == '/ram/testpkg/test.py' - assert test.__file__ == '/ram/testpkg/test.py' + filename = Filename('/ram/testpkg/test.py').to_os_specific() + assert test.__spec__.origin == filename + assert test.__file__ == filename from testnspkg import test assert test.var == 4 assert test.__spec__.name == 'testnspkg.test' - assert test.__spec__.origin == '/ram/testnspkg/test.py' - assert test.__file__ == '/ram/testnspkg/test.py' + filename = Filename('/ram/testnspkg/test.py').to_os_specific() + assert test.__spec__.origin == filename + assert test.__file__ == filename finally: vfs.unmount(mount)