コード例 #1
0
def test_noexceptions(nb_path, tmpdir):
    """Ensure that no cells raise an exception."""
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % str(
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
コード例 #2
0
def test_noexceptions(nb_path, tmpdir):
    """Ensure that no cells raise an exception."""
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % str(
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
コード例 #3
0
ファイル: test_examples.py プロジェクト: annayang1/nengo
def assert_noexceptions(nb_file, tmpdir):
    plt = pytest.importorskip("matplotlib.pyplot")
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close("all")
コード例 #4
0
ファイル: test_examples.py プロジェクト: jepetolee/nengo
def assert_noexceptions(nb_file, tmp_path):
    plt = pytest.importorskip("matplotlib.pyplot")
    nb_path = examples_dir / f"{nb_file}.ipynb"
    nb = load_notebook(nb_path)
    pyfile = tmp_path / (nb_path.stem + ".py")
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close("all")
コード例 #5
0
def test_notebooks(fname, tmpdir, plt):
    import matplotlib
    matplotlib.use('Agg')
    import pylab as _pylab
    _pylab.show = lambda: warnings.warn("Skipping command: 'pylab.show()'")
    py = os.path.join(str(tmpdir), "notebook.py")
    export_py(load_notebook(fname), py)
    execfile(py, {'get_ipython': _get_ipython, 'pylab': _pylab})
コード例 #6
0
ファイル: test_notebooks.py プロジェクト: arvoelke/nengolib
def test_notebooks(fname, tmpdir, plt):
    import matplotlib
    matplotlib.use('Agg')
    import pylab as _pylab
    _pylab.show = lambda: warnings.warn("Skipping command: 'pylab.show()'")
    py = os.path.join(str(tmpdir), "notebook.py")
    export_py(load_notebook(fname), py)
    execfile(py, {'get_ipython': _get_ipython, 'pylab': _pylab})
コード例 #7
0
ファイル: test_examples.py プロジェクト: nengo/nengo
def assert_noexceptions(nb_file, tmpdir):
    plt = pytest.importorskip('matplotlib.pyplot')
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close('all')
コード例 #8
0
def assert_noexceptions(nb_file, tmpdir, plt):
    from nengo.utils.ipython import export_py, load_notebook
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (tmpdir.join(
        os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    # Note: plt imported but not used to ensure figures are closed
    plt.saveas = None
コード例 #9
0
ファイル: test_examples.py プロジェクト: LittileBee/nengo
def assert_noexceptions(nb_file, tmpdir, plt):
    from nengo.utils.ipython import export_py, load_notebook
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    # Note: plt imported but not used to ensure figures are closed
    plt.saveas = None
コード例 #10
0
def assert_noexceptions(nb_file, tmpdir, plt):
    plt.saveas = None  # plt used to ensure figures are closed, but don't save
    pytest.importorskip("IPython", minversion="1.0")
    pytest.importorskip("jinja2")
    from nengo.utils.ipython import export_py, load_notebook
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
コード例 #11
0
ファイル: test_examples.py プロジェクト: dunovank/nengo
def test_noexceptions(nb_path, tmpdir, plt):
    """Ensure that no cells raise an exception."""
    pytest.importorskip("IPython", minversion="1.0")
    from nengo.utils.ipython import export_py, load_notebook
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (tmpdir.join(
        os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    # Note: plt imported but not used to ensure figures are closed
    plt.saveas = None
コード例 #12
0
ファイル: test_examples.py プロジェクト: bjkomer/nengo-spa
def assert_noexceptions(nb_file, tmpdir):
    plt = pytest.importorskip("matplotlib.pyplot")
    pytest.importorskip("IPython", minversion="1.0")
    pytest.importorskip("jinja2")
    from nengo.utils.ipython import export_py

    nb = load_example(nb_file)
    pyfile = "%s.py" % tmpdir.join(os.path.basename(nb_file))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close("all")
コード例 #13
0
ファイル: test_examples.py プロジェクト: Ocode/nengo
def test_noexceptions(nb_path, tmpdir, plt):
    """Ensure that no cells raise an exception."""
    pytest.importorskip("IPython", minversion="1.0")
    from nengo.utils.ipython import export_py, load_notebook
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    # Note: plt imported but not used to ensure figures are closed
    plt.saveas = None
コード例 #14
0
def assert_noexceptions(nb_file, tmpdir):
    plt = pytest.importorskip('matplotlib.pyplot')
    pytest.importorskip("IPython", minversion="1.0")
    pytest.importorskip("jinja2")
    from nengo.utils.ipython import export_py, load_notebook
    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (
        tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close('all')
コード例 #15
0
ファイル: test_examples.py プロジェクト: nengo/nengo
def assert_noexceptions(nb_file, tmpdir):
    plt = pytest.importorskip("matplotlib.pyplot")
    pytest.importorskip("IPython", minversion="1.0")
    pytest.importorskip("jinja2")
    from nengo.utils.ipython import export_py, load_notebook

    nb_path = os.path.join(examples_dir, "%s.ipynb" % nb_file)
    nb = load_notebook(nb_path)
    pyfile = "%s.py" % (tmpdir.join(os.path.splitext(os.path.basename(nb_path))[0]))
    export_py(nb, pyfile)
    execfile(pyfile, {})
    plt.close("all")