
import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current import read

from pyfolio.utils import pyfolio_root


def test_nbs():
    path = os.path.join(pyfolio_root(), 'examples', '*.ipynb')
    for ipynb in glob.glob(path):
        with open(ipynb) as f:
            nb = read(f, 'json')
            nb_runner = NotebookRunner(nb)
            nb_runner.run_notebook(skip_exceptions=False)


import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current import read

from pyfolio.utils import pyfolio_root


def test_nbs():
    path = os.path.join(pyfolio_root(), 'examples', '*.ipynb')
    for ipynb in glob.glob(path):

        # See if bayesian is useable before we run a test
        if ipynb.endswith('bayesian.ipynb'):
            try:
                import pyfolio.bayesian  # NOQA
            except:
                continue

        with open(ipynb) as f:
            nb = read(f, 'json')
            nb_runner = NotebookRunner(nb)
            nb_runner.run_notebook(skip_exceptions=False)

Make nb_tests for bayesian optional because PyMC3 is not a hard dependency
TST: Make nb_tests for bayesian optional because PyMC3 is not a hard dependency

  
  import os
  import glob
  from runipy.notebook_runner import NotebookRunner
  from IPython.nbformat.current import read
  
  from pyfolio.utils import pyfolio_root
  
  
  def test_nbs():
      path = os.path.join(pyfolio_root(), 'examples', '*.ipynb')
      for ipynb in glob.glob(path):
+ 
+         # See if bayesian is useable before we run a test
+         if ipynb.endswith('bayesian.ipynb'):
+             try:
+                 import pyfolio.bayesian  # NOQA
+             except:
+                 continue
+ 
          with open(ipynb) as f:
              nb = read(f, 'json')
              nb_runner = NotebookRunner(nb)
              nb_runner.run_notebook(skip_exceptions=False)
  
Make nb_tests for bayesian optional because PyMC3 is not a hard dependency
## Code Before:

import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current import read

from pyfolio.utils import pyfolio_root


def test_nbs():
    path = os.path.join(pyfolio_root(), 'examples', '*.ipynb')
    for ipynb in glob.glob(path):
        with open(ipynb) as f:
            nb = read(f, 'json')
            nb_runner = NotebookRunner(nb)
            nb_runner.run_notebook(skip_exceptions=False)

## Instruction:
Make nb_tests for bayesian optional because PyMC3 is not a hard dependency
## Code After:

import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current import read

from pyfolio.utils import pyfolio_root


def test_nbs():
    path = os.path.join(pyfolio_root(), 'examples', '*.ipynb')
    for ipynb in glob.glob(path):

        # See if bayesian is useable before we run a test
        if ipynb.endswith('bayesian.ipynb'):
            try:
                import pyfolio.bayesian  # NOQA
            except:
                continue

        with open(ipynb) as f:
            nb = read(f, 'json')
            nb_runner = NotebookRunner(nb)
            nb_runner.run_notebook(skip_exceptions=False)
