Extension serialization attr tests: add teardown

The doc/token extension serialization tests add extensions that are not
serializable with pickle. This didn't cause issues before due to the
implicit run order of tests. However, test ordering has changed with
pytest 8.0.0, leading to failed tests in test_language.

Update the fixtures in the extension serialization tests to do proper
teardown and remove the extensions.
This commit is contained in:
Daniël de Kok 2024-01-29 12:44:27 +01:00
parent 00e938a7c3
commit cc118baee0

View File

@ -15,7 +15,12 @@ def doc_w_attrs(en_tokenizer):
Token.set_extension("_test_token", default="t0")
doc[1]._._test_token = "t1"
return doc
yield doc
Doc.remove_extension("_test_attr")
Doc.remove_extension("_test_prop")
Doc.remove_extension("_test_method")
Token.remove_extension("_test_token")
def test_serialize_ext_attrs_from_bytes(doc_w_attrs):