Skip to content

Commit

Permalink
tests: fix a test for session saving (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
leogama committed Jun 7, 2022
1 parent 74de347 commit 260b372
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
for test in tests:
p = sp.Popen([python, test], shell=shell).wait()
if not p:
print('.', end='')
print('.', end='', flush=True)
print('')
6 changes: 3 additions & 3 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ def test_objects(main, copy_dict, byref):
dump = test_file.getvalue()
test_file.close()

sys.modules[modname] = ModuleType(modname) # empty
main = sys.modules[modname] = ModuleType(modname) # empty
# This should work after fixing https://github.com/uqfoundation/dill/issues/462
test_file = dill._dill.StringIO(dump)
dill.load_session(test_file)
dill.load_session(test_file, main=main)
finally:
test_file.close()

assert x == 42
assert main.x == 42


# Dump session for module that is not __main__:
Expand Down

0 comments on commit 260b372

Please sign in to comment.