-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
refactoringCode improvement without behavior changeCode improvement without behavior change
Description
The code inspection in MockMetaData can make problems under Jupyter, for that reason, we need to test it with ipython.
You can run code under ipython as follows:
import IPython
from traitlets.config import Config
import multiprocessing
def run_ipython_first():
c = Config()
c.InteractiveShellApp.code_to_run = """
print('exit1')
exit()
"""
c.InteractiveShell.confirm_exit = False
IPython.start_ipython(config=c)
print("after1")
def run_ipython_second():
c = Config()
c.InteractiveShellApp.code_to_run = """
print('assert2')
assert 1==0
"""
c.InteractiveShell.confirm_exit = False
IPython.start_ipython(config=c)
print("after2") # This will never print because the IPython instance will raise an AssertionError
if __name__ == "__main__":
p1 = multiprocessing.Process(target=run_ipython_first)
p2 = multiprocessing.Process(target=run_ipython_second)
p1.start()
p1.join() # Wait for the first process to finish
p2.start()
p2.join() # Wait for the second process to finish
Metadata
Metadata
Assignees
Labels
refactoringCode improvement without behavior changeCode improvement without behavior change