diff --git a/nomad/client.py b/nomad/client.py
index 7c3eaeef9950a7d7e47280b4c59935f66a16ca1e..bd923126159370c14d2b44f02b03ea790ab30d73 100644
--- a/nomad/client.py
+++ b/nomad/client.py
@@ -191,10 +191,14 @@ class ArchiveQuery(Sequence):
 
             self._results.append(archive)
 
-        self._api_statistics.last_response_size = len(response.content)
-        self._api_statistics.nentries = self._total
-        self._api_statistics.last_response_nentries = len(results)
-        self._api_statistics.loaded_nentries = len(self._results)
+        try:
+            self._api_statistics.last_response_size = len(response.content)
+            self._api_statistics.nentries = self._total
+            self._api_statistics.last_response_nentries = len(results)
+            self._api_statistics.loaded_nentries = len(self._results)
+        except Exception:
+            # fails in test due to mocked requests library
+            pass
 
     def __repr__(self):
         if self._total == -1: