diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index 4d63bbb5ab4..8b481c07955 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -227,6 +227,7 @@ def __init__(self, ipython_app, kernel_manager, notebook_manager,
aliases = dict(ipkernel_aliases)
aliases.update({
+ 'nbmgr': 'NotebookApp.nbmgr',
'ip': 'NotebookApp.ip',
'port': 'NotebookApp.port',
'port-retries': 'NotebookApp.port_retries',
@@ -241,7 +242,7 @@ def __init__(self, ipython_app, kernel_manager, notebook_manager,
aliases.pop('f', None)
notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile',
- u'notebook-dir']
+ u'notebook-dir', u'nbmgr']
#-----------------------------------------------------------------------------
# NotebookApp
@@ -277,6 +278,9 @@ class NotebookApp(BaseIPythonApplication):
# file to be opened in the notebook server
file_to_run = Unicode('')
+ # Which alternative NotebookManager to use
+ nbmgr = Unicode(u'', config=True, help="""Alternative notebook manager module""")
+
# Network related information.
ip = Unicode(LOCALHOST, config=True,
@@ -430,7 +434,14 @@ def init_configurables(self):
config=self.config, log=self.log, kernel_argv=self.kernel_argv,
connection_dir = self.profile_dir.security_dir,
)
- self.notebook_manager = NotebookManager(config=self.config, log=self.log)
+
+ # added option to load alternative notebook
+ if self.nbmgr and self.nbmgr != "":
+ loader = __import__(self.nbmgr, globals(), locals(), ['get_notebook_manager'], -1)
+ self.notebook_manager = loader.get_notebook_manager()
+ else:
+ self.notebook_manager = NotebookManager(config=self.config, log=self.log)
+
self.log.info("Serving notebooks from %s", self.notebook_manager.notebook_dir)
self.notebook_manager.list_notebooks()
self.cluster_manager = ClusterManager(config=self.config, log=self.log)
diff --git a/IPython/frontend/terminal/embed.py b/IPython/frontend/terminal/embed.py
index 18123bcd8c9..c4999c42910 100644
--- a/IPython/frontend/terminal/embed.py
+++ b/IPython/frontend/terminal/embed.py
@@ -200,7 +200,8 @@ class DummyMod(object):
module.__dict__ = global_ns
# Get locals and globals from caller
- if (local_ns is None or module is None) and self.default_user_namespaces:
+ if ((local_ns is None or module is None or compile_flags is None)
+ and self.default_user_namespaces):
call_frame = sys._getframe(stack_depth).f_back
if local_ns is None:
@@ -233,7 +234,8 @@ class DummyMod(object):
self.init_user_ns()
# Compiler flags
- self.compile.flags = compile_flags
+ if compile_flags is not None:
+ self.compile.flags = compile_flags
# Patch for global embedding to make sure that things don't overwrite
# user globals accidentally. Thanks to Richard
diff --git a/docs/source/development/testing.txt b/docs/source/development/testing.txt
index e59e7ba405e..107dbaa95a8 100644
--- a/docs/source/development/testing.txt
+++ b/docs/source/development/testing.txt
@@ -66,6 +66,8 @@ the full test suite. You can then run the suite with:
iptest [args]
+By default, this excludes the relatively slow tests for ``IPython.parallel``. To
+run these, use ``iptest --all``.
Regardless of how you run things, you should eventually see something like:
@@ -139,6 +141,23 @@ point of the error or failure respectively.
and include the resulting information in your query.
+Testing pull requests
+---------------------
+
+We have a script that fetches a pull request from Github, merges it with master,
+and runs the test suite on different versions of Python. This uses a separate
+copy of the repository, so you can keep working on the code while it runs. To
+run it::
+
+ python tools/test_pr.py -p 1234
+
+The number is the pull request number from Github; the ``-p`` flag makes it post
+the results to a comment on the pull request. Any further arguments are passed
+to ``iptest``.
+
+This requires the `requests `_ and
+`keyring `_ packages.
+
For developers: writing tests
=============================
diff --git a/tools/test_pr.py b/tools/test_pr.py
index fd563704438..437be4ae91d 100755
--- a/tools/test_pr.py
+++ b/tools/test_pr.py
@@ -91,6 +91,7 @@ def setup(self):
check_call(['git', 'pull', 'origin', 'master'])
except CalledProcessError :
check_call(['git', 'pull', ipy_http_repository, 'master'])
+ self.master_sha = check_output(['git', 'log', '-1', '--format=%h']).decode('ascii').strip()
os.chdir(basedir)
def get_branch(self):
@@ -125,7 +126,7 @@ def format_result(result):
return s
if self.pr['mergeable']:
- com = self.pr['head']['sha'][:7] + " merged into master"
+ com = self.pr['head']['sha'][:7] + " merged into master (%s)" % self.master_sha
else:
com = self.pr['head']['sha'][:7] + " (can't merge cleanly)"
lines = ["**Test results for commit %s**" % com,
@@ -146,10 +147,12 @@ def print_results(self):
pr = self.pr
print("\n")
+ msg = "**Test results for commit %s" % pr['head']['sha'][:7]
if pr['mergeable']:
- print("**Test results for commit %s merged into master**" % pr['head']['sha'][:7])
+ msg += " merged into master (%s)**" % self.master_sha
else:
- print("**Test results for commit %s (can't merge cleanly)**" % pr['head']['sha'][:7])
+ msg += " (can't merge cleanly)**"
+ print(msg)
print("Platform:", sys.platform)
for result in self.results:
if result.passed: