Skip to content

Commit

Permalink
Test pickling of Options with dill
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Jun 14, 2022
1 parent 32b880e commit c9b37f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install pytest dill
- name: Test with pytest
run: |
pytest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install pytest dill
- name: Test with pytest
run: |
pytest
Expand Down
10 changes: 10 additions & 0 deletions optionsfactory/tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,13 @@ def test_nested_with_arg_initialise(self):
assert opts.doc["subsection2"]["e"] is None
assert opts.subsection2.subsubsection.doc["f"] == "option f"
assert opts.subsection3.doc["z"] == "option z"

def test_dill_pickling(self):
import dill

factory = OptionsFactory(foo="bar")
options = factory.create()
pickled = dill.dumps(options)
unpickled = dill.loads(pickled, ignore=True)

assert unpickled.foo == "bar"
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"checking"
),
extras_require={"yaml": "PyYAML>=5.1"},
tests_require=["dill>=0.3.0"],
license="OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit c9b37f2

Please sign in to comment.