Show More
@@ -13,6 +13,7 b' object and then create the configurable objects, passing the config to them.' | |||
|
13 | 13 | # Distributed under the terms of the Modified BSD License. |
|
14 | 14 | |
|
15 | 15 | import atexit |
|
16 | from copy import deepcopy | |
|
16 | 17 | import glob |
|
17 | 18 | import logging |
|
18 | 19 | import os |
@@ -447,7 +448,9 b' class BaseIPythonApplication(Application):' | |||
|
447 | 448 | if self.subapp is not None: |
|
448 | 449 | # stop here if subapp is taking over |
|
449 | 450 | return |
|
450 | cl_config = self.config | |
|
451 | # save a copy of CLI config to re-load after config files | |
|
452 | # so that it has highest priority | |
|
453 | cl_config = deepcopy(self.config) | |
|
451 | 454 | self.init_profile_dir() |
|
452 | 455 | self.init_config_files() |
|
453 | 456 | self.load_config_file() |
@@ -4,9 +4,15 b'' | |||
|
4 | 4 | import os |
|
5 | 5 | import tempfile |
|
6 | 6 | |
|
7 | import nose.tools as nt | |
|
8 | ||
|
9 | from traitlets import Unicode | |
|
10 | ||
|
7 | 11 | from IPython.core.application import BaseIPythonApplication |
|
8 | 12 | from IPython.testing import decorators as dec |
|
9 | 13 | from IPython.utils import py3compat |
|
14 | from IPython.utils.tempdir import TemporaryDirectory | |
|
15 | ||
|
10 | 16 | |
|
11 | 17 | @dec.onlyif_unicode_paths |
|
12 | 18 | def test_unicode_cwd(): |
@@ -48,3 +54,21 b' def test_unicode_ipdir():' | |||
|
48 | 54 | os.environ["IPYTHONDIR"] = old_ipdir1 |
|
49 | 55 | if old_ipdir2: |
|
50 | 56 | os.environ["IPYTHONDIR"] = old_ipdir2 |
|
57 | ||
|
58 | def test_cli_priority(): | |
|
59 | with TemporaryDirectory() as td: | |
|
60 | ||
|
61 | class TestApp(BaseIPythonApplication): | |
|
62 | test = Unicode().tag(config=True) | |
|
63 | ||
|
64 | # Create the config file, so it tries to load it. | |
|
65 | with open(os.path.join(td, 'ipython_config.py'), "w") as f: | |
|
66 | f.write("c.TestApp.test = 'config file'") | |
|
67 | ||
|
68 | app = TestApp() | |
|
69 | app.initialize(['--profile-dir', td]) | |
|
70 | nt.assert_equal(app.test, 'config file') | |
|
71 | app = TestApp() | |
|
72 | app.initialize(['--profile-dir', td, '--TestApp.test=cli']) | |
|
73 | nt.assert_equal(app.test, 'cli') | |
|
74 |
General Comments 0
You need to be logged in to leave comments.
Login now