vyperlang / titanoboa

a vyper interpreter
https://titanoboa.readthedocs.io
Other
242 stars 41 forks source link

fix: unit tests #160

Closed DanielSchiavini closed 5 months ago

DanielSchiavini commented 5 months ago

What I did

Fixed unit tests that were broken in master

How I did it

By mocking IPython.core.interactiveshell - that imports pickleshare which is not available outside Jupyter installations.

How to verify it

Tests should be green

Description for the changelog

N/A

Cute Animal Picture

image

charles-cooper commented 5 months ago

hmm, looks like maybe the issue stems from ipython accessing sys.modules directly?

~/src-references/ipython/ipykernel $ git grep sys.modules
ipykernel/debugger.py:        modules = list(sys.modules.values())
ipykernel/embed.py:        # Undo unnecessary sys module mangling from init_sys_modules.
ipykernel/embed.py:        main = app.kernel.shell._orig_sys_modules_main_mod
ipykernel/embed.py:            sys.modules[app.kernel.shell._orig_sys_modules_main_name] = main
ipykernel/eventloops.py:            return operator.attrgetter(name.rpartition(".")[0])(sys.modules[QtCore.__package__])
ipykernel/pickleutil.py:            g = sys.modules[self.module].__dict__
ipykernel/zmqshell.py:        if "ipyparallel" in sys.modules:
charles-cooper commented 5 months ago

ah okay, this is not a regression introduced by the new modules hooks, this issue has been going on for quite awhile (at least since test_browser.py was introduced in 31911c3b7b4159130febb5b081a43d9c3b802ff6)

charles-cooper commented 5 months ago

running this locally (with the ipython package removed) i am still getting some errors:

        else:
>           raise ImportError(fullname)
E           ImportError: IPython

boa/interpret.py:48: ImportError
=========================== short test summary info ============================
ERROR tests/unitary/jupyter/test_browser.py::test_nest_applied - ImportError: IPython