Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Skipping permission test error if the user has root privileges

Amerr, Ziad (ext) (DI SW ICS MNA RD QA QST 2)d944f6591eb8
diff --git a/tests/resources/test_file_resources.py b/tests/resources/test_file_resources.py
index cb622229a..4d2bc63cf 100644
--- a/tests/resources/test_file_resources.py
+++ b/tests/resources/test_file_resources.py
@@ -99,7 +99,8 @@ class TestFileResource:
await resource.read()
@pytest.mark.skipif(
- os.name == "nt", reason="File permissions behave differently on Windows"
+ os.name == "nt" or os.getuid() == 0,
+ reason="File permissions behave differently on Windows or when running as root"
)
async def test_permission_error(self, temp_file: Path):
"""Test reading a file without permissions."""