Skip to content

Commit

Permalink
python36 xfail test: use pickle.dumps instead of pickle.dump
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasha10 committed Oct 6, 2021
1 parent 79b5d2b commit 7fb6fe5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,12 @@ def test_pickle_backward_compatibility(version: str) -> None:
@mark.xfail(reason="python3.6 pickling error is not handled")
def test_python36_pickle_optional() -> None:
cfg = OmegaConf.structured(SubscriptedDictOpt)
with tempfile.TemporaryFile() as fp:
with raises(
OmegaConfBaseException,
match=re.escape(
"Serializing structured configs with `Union` type annotations requires python >= 3.7"
),
):
# currently this raises the following:
# _pickle.PicklingError: Can't pickle typing.Union[int, NoneType]: it's not the same object as typing.Union
pickle.dump(cfg, fp)
with raises(
OmegaConfBaseException,
match=re.escape(
"Serializing structured configs with `Union` type annotations requires python >= 3.7"
),
):
# currently this raises the following:
# _pickle.PicklingError: Can't pickle typing.Union[int, NoneType]: it's not the same object as typing.Union
pickle.dumps(cfg)

0 comments on commit 7fb6fe5

Please sign in to comment.