Skip to content

Commit

Permalink
Extension serialization attr tests: add teardown (#13284)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danieldk authored Jan 29, 2024
1 parent 00e938a commit 68d7841
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spacy/tests/serialize/test_serialize_extension_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 68d7841

Please sign in to comment.