From fe2dbdcd58abacdaba68f59385fe33582acbb32b Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 25 Sep 2024 16:58:50 -0700 Subject: [PATCH] indexerror finding filesystem root --- tests/test_serialization.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 6fc6dd3..e1c2cee 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -82,7 +82,11 @@ def test_relative_to_root_dir(): beneath the root directory (eg `/data`) even if they exist """ - root = Path().resolve().parents[-1] + try: + root = Path().resolve().parents[-1] + except IndexError: + root = Path("/").resolve() + test_path = None for path in root.iterdir(): if path.is_dir():