-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from minrk/config-arg
allow specifying config file with `--config FILE`
- Loading branch information
Showing
2 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
from jupyter_core import application | ||
from tempfile import NamedTemporaryFile | ||
|
||
from traitlets import Integer | ||
|
||
from jupyter_core.application import JupyterApp | ||
|
||
def test_basic(): | ||
app = application.JupyterApp() | ||
app = JupyterApp() | ||
|
||
def test_default_traits(): | ||
app = application.JupyterApp() | ||
app = JupyterApp() | ||
for trait_name in app.traits(): | ||
value = getattr(app, trait_name) | ||
|
||
class DummyApp(JupyterApp): | ||
n = Integer(0, config=True) | ||
|
||
_dummy_config = """ | ||
c.DummyApp.n = 10 | ||
""" | ||
|
||
def test_custom_config(): | ||
app = DummyApp() | ||
with NamedTemporaryFile(suffix='.py', mode='w') as f: | ||
f.write(_dummy_config) | ||
f.flush() | ||
app.initialize(['--config', f.name]) | ||
assert app.config_file == f.name | ||
assert app.n == 10 |