diff --git a/csppfetch/test.py b/csppfetch/test.py
index da48259d73e734b2307fcf8ed29c462e5dc58c7c..68b5f929256215e464a649caedffe3b3af5cb134 100755
--- a/csppfetch/test.py
+++ b/csppfetch/test.py
@@ -1121,4 +1121,12 @@ if __name__ == '__main__':
     import logging
     #logging.basicConfig(format='%(process)d:%(levelname)s:%(message)s', level=logging.DEBUG)
 
+    if os.getuid() == 0:
+        import pwd
+        try:
+            pwent = pwd.getpwnam("nobody")
+        except KeyError:
+            raise Exception("Running as root; tried to switch to 'nobody', but there is no account by that name")
+        os.setuid(pwent.pw_uid)
+
     unittest.main()