From e38612a009d5774aa648139f51f344ab99b1cb7b 2014-01-31 19:40:49 From: Thomas Kluyver Date: 2014-01-31 19:40:49 Subject: [PATCH] Backport PR #4934: `ipython profile create` respects `--ipython-dir` closes #4704 --- diff --git a/IPython/core/profileapp.py b/IPython/core/profileapp.py index 47ebd44..96948a9 100644 --- a/IPython/core/profileapp.py +++ b/IPython/core/profileapp.py @@ -280,8 +280,8 @@ class ProfileCreate(BaseIPythonApplication): app.log = self.log app.overwrite = self.overwrite app.copy_config_files=True - app.profile = self.profile - app.init_profile_dir() + app.ipython_dir=self.ipython_dir + app.profile_dir=self.profile_dir app.init_config_files() def stage_default_config_file(self): diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index 2a10d1a..9c62716 100644 --- a/IPython/core/tests/test_profile.py +++ b/IPython/core/tests/test_profile.py @@ -36,7 +36,8 @@ from IPython.core.profiledir import ProfileDir from IPython.testing import decorators as dec from IPython.testing import tools as tt from IPython.utils import py3compat - +from IPython.utils.process import getoutput +from IPython.utils.tempdir import TemporaryDirectory #----------------------------------------------------------------------------- # Globals @@ -151,3 +152,15 @@ def test_list_bundled_profiles(): bundled_true = [u'cluster', u'math', u'pysh', u'sympy'] bundled = sorted(list_bundled_profiles()) nt.assert_equal(bundled, bundled_true) + + +def test_profile_create_ipython_dir(): + """ipython profile create respects --ipython-dir""" + with TemporaryDirectory() as td: + getoutput([sys.executable, '-m', 'IPython', 'profile', 'create', + 'foo', '--ipython-dir=%s' % td]) + profile_dir = os.path.join(td, 'profile_foo') + assert os.path.exists(profile_dir) + ipython_config = os.path.join(profile_dir, 'ipython_config.py') + assert os.path.exists(ipython_config) + \ No newline at end of file