More deprecation warnings (#3579)

* Fixed more deprecation warnings

* unused import
diff --git a/tests/test_x509.py b/tests/test_x509.py
index c15940e..110d853 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -9,7 +9,6 @@
 import ipaddress
 import os
 import sys
-import warnings
 
 from asn1crypto.x509 import Certificate
 
@@ -522,8 +521,7 @@
             backend
         )
 
-        with warnings.catch_warnings():
-            warnings.simplefilter("always", utils.PersistentlyDeprecated)
+        with pytest.deprecated_call():
             assert cert.serial == 2
             assert cert.serial_number == 2
 
@@ -534,10 +532,8 @@
             backend
         )
 
-        with warnings.catch_warnings():
-            warnings.simplefilter("always", utils.PersistentlyDeprecated)
-            with pytest.deprecated_call():
-                cert.serial
+        with pytest.deprecated_call():
+            cert.serial
 
     def test_load_der_cert(self, backend):
         cert = _load_cert(