def test_user_setup(): # use a lambda to pass kwargs to the generator user_setup = lambda a, k: iplib.user_setup(*a, **k) kw = dict(mode='install', interactive=False) # Call the user setup and verify that the directory exists yield user_setup, (ip.options.ipythondir, ''), kw yield os.path.isdir, ip.options.ipythondir # Now repeat the operation with a non-existent directory. Check both that # the call succeeds and that the directory is created. tmpdir = tempfile.mktemp(prefix='ipython-test-') # Use a try with an empty except because try/finally doesn't work with a # yield in Python 2.4. try: yield user_setup, (tmpdir, ''), kw yield os.path.isdir, tmpdir except: pass # Clean up the temp dir once done shutil.rmtree(tmpdir)
def test_user_setup(): # use a lambda to pass kwargs to the generator user_setup = lambda a,k: iplib.user_setup(*a,**k) kw = dict(mode='install', interactive=False) # Call the user setup and verify that the directory exists yield user_setup, (ip.options.ipythondir,''), kw yield os.path.isdir, ip.options.ipythondir # Now repeat the operation with a non-existent directory. Check both that # the call succeeds and that the directory is created. tmpdir = tempfile.mktemp(prefix='ipython-test-') # Use a try with an empty except because try/finally doesn't work with a # yield in Python 2.4. try: yield user_setup, (tmpdir,''), kw yield os.path.isdir, tmpdir except: pass # Clean up the temp dir once done shutil.rmtree(tmpdir)
from IPython.genutils import ( get_ipython_dir, get_log_dir, get_security_dir, num_cpus ) from IPython.kernel.fcutil import have_crypto # Create various ipython directories if they don't exist. # This must be done before IPython.kernel.config is imported. from IPython.iplib import user_setup if os.name == 'posix': rc_suffix = '' else: rc_suffix = '.ini' user_setup(get_ipython_dir(), rc_suffix, mode='install', interactive=False) get_log_dir() get_security_dir() from IPython.kernel.config import config_manager as kernel_config_manager from IPython.kernel.error import SecurityError, FileTimeoutError from IPython.kernel.fcutil import have_crypto from IPython.kernel.twistedutil import gatherBoth, wait_for_file from IPython.kernel.util import printer #----------------------------------------------------------------------------- # General process handling code #----------------------------------------------------------------------------- class ProcessStateError(Exception):
from IPython.kernel.fcutil import Tub, UnauthenticatedTub from IPython.kernel.core.config import config_manager as core_config_manager from IPython.config.cutils import import_item from IPython.kernel.engineservice import EngineService # Create various ipython directories if they don't exist. # This must be done before IPython.kernel.config is imported. from IPython.iplib import user_setup from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir if os.name == 'posix': rc_suffix = '' else: rc_suffix = '.ini' user_setup(get_ipython_dir(), rc_suffix, mode='install', interactive=False) get_log_dir() get_security_dir() from IPython.kernel.config import config_manager as kernel_config_manager from IPython.kernel.engineconnector import EngineConnector #------------------------------------------------------------------------------- # Code #------------------------------------------------------------------------------- def start_engine(): """ Start the engine, by creating it and starting the Twisted reactor.