Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure with IPython 7 #898

Closed
toddrme2178 opened this issue Oct 16, 2018 · 8 comments
Closed

Test failure with IPython 7 #898

toddrme2178 opened this issue Oct 16, 2018 · 8 comments
Labels
workaround known Bug with a known way to get around it

Comments

@toddrme2178
Copy link
Contributor

I am trying to package IPython 7 for openSUSE and we are getting the following build error when building nbconvert against it:

=================================== FAILURES ===================================
________________________ TestExecute.test_run_notebooks ________________________

self = <nbconvert.preprocessors.tests.test_execute.TestExecute testMethod=test_run_notebooks>

    def test_run_notebooks(self):
        """Runs a series of test notebooks and compares them to their actual output"""
        input_files = glob.glob(os.path.join(current_dir, 'files', '*.ipynb'))
        shared_opts = dict(kernel_name="python")
        for filename in input_files:
            if os.path.basename(filename) == "Disable Stdin.ipynb":
                continue
            elif os.path.basename(filename) == "Interrupt.ipynb":
                opts = dict(timeout=1, interrupt_on_timeout=True, allow_errors=True)
            elif os.path.basename(filename) == "Skip Exceptions.ipynb":
                opts = dict(allow_errors=True)
            else:
                opts = dict()
            res = self.build_resources()
            res['metadata']['path'] = os.path.dirname(filename)
            opts.update(shared_opts)
            input_nb, output_nb = self.run_notebook(filename, opts, res)
>           self.assert_notebooks_equal(input_nb, output_nb)

../../../BUILDROOT/python-jupyter_nbconvert-5.4.0-15.18.x86_64/usr/lib/python3.6/site-packages/nbconvert/preprocessors/tests/test_execute.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../BUILDROOT/python-jupyter_nbconvert-5.4.0-15.18.x86_64/usr/lib/python3.6/site-packages/nbconvert/preprocessors/tests/test_execute.py:80: in assert_notebooks_equal
    self.assertEqual(normalized_expected_outputs, normalized_actual_outputs)
E   AssertionError: Lists differ: [{'ename': 'KeyboardInterrupt', 'evalue': ''[278 chars] ']}] != [{'output_type': 'error', 'ename': 'Keyboard[276 chars] ']}]
E   
E   First differing element 0:
E   {'ename': 'KeyboardInterrupt', 'evalue': ''[277 chars]: ']}
E   {'output_type': 'error', 'ename': 'Keyboard[275 chars]: ']}
E   
E     [{'ename': 'KeyboardInterrupt',
E       'evalue': '',
E       'output_type': 'error',
E       'traceback': ['---------------------------------------------------------------------------',
E                     'KeyboardInterrupt                         Traceback (most '
E                     'recent call last)',
E   -                 '<IPY-INPUT> in <module>()\n----> 1 while True: continue\n',
E   ?                                         --
E   
E   +                 '<IPY-INPUT> in <module>\n----> 1 while True: continue\n',
E                     'KeyboardInterrupt: ']}]
------------------------------ Captured log call -------------------------------
execute.py                 426 ERROR    Timeout waiting for execute reply (1s).
execute.py                 428 ERROR    Interrupting kernel
@takluyver
Copy link
Member

I just came across this and fixed it as an incidental part of #809 .

@costrouc
Copy link

costrouc commented Nov 3, 2018

Is this related? I am packaging for ipython 7 for nixpkgs and I ran into the exact issue with a slight different test failure but similar enough.

________________________ TestExecute.test_run_notebooks ________________________

self = <nbconvert.preprocessors.tests.test_execute.TestExecute testMethod=test_run_notebooks>

    def test_run_notebooks(self):
        """Runs a series of test notebooks and compares them to their actual output"""
        input_files = glob.glob(os.path.join(current_dir, 'files', '*.ipynb'))
        shared_opts = dict(kernel_name="python")
        for filename in input_files:
            if os.path.basename(filename) == "Disable Stdin.ipynb":
                continue
            elif os.path.basename(filename) == "Interrupt.ipynb":
                opts = dict(timeout=1, interrupt_on_timeout=True, allow_errors=True)
            elif os.path.basename(filename) == "Skip Exceptions.ipynb":
                opts = dict(allow_errors=True)
            else:
                opts = dict()
            res = self.build_resources()
            res['metadata']['path'] = os.path.dirname(filename)
            opts.update(shared_opts)
            input_nb, output_nb = self.run_notebook(filename, opts, res)
>           self.assert_notebooks_equal(input_nb, output_nb)

nbconvert/preprocessors/tests/test_execute.py:139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbconvert/preprocessors/tests/test_execute.py:80: in assert_notebooks_equal
    self.assertEqual(normalized_expected_outputs, normalized_actual_outputs)
E   AssertionError: Lists differ: [{'ename': 'Exception', 'evalue': 'message',[301 chars]e']}] != [{'output_type': 'error', 'ename': 'Exceptio[299 chars]e']}]
E
E   First differing element 0:
E   {'ename': 'Exception', 'evalue': 'message',[300 chars]ge']}
E   {'output_type': 'error', 'ename': 'Exceptio[298 chars]ge']}
E
E     [{'ename': 'Exception',
E       'evalue': 'message',
E       'output_type': 'error',
E       'traceback': ['---------------------------------------------------------------------------',
E                     'Exception                                 Traceback (most '
E                     'recent call last)',
E   -                 '<IPY-INPUT> in <module>()\n'
E   ?                                         --
E
E   +                 '<IPY-INPUT> in <module>\n'
E                     '      1 # üñîçø∂é\n'
E                     '----> 2 raise Exception("message")\n',
E                     'Exception: message']}]

@takluyver
Copy link
Member

Yup, the traceback format changed slightly in IPython 7. Unfortunately nbconvert has a few tests which are checking against saved notebooks created with earlier versions.

@toddrme2178
Copy link
Contributor Author

So what is the best approach for downstream packagers? I would prefer to not disable tests entirely if I can avoid it.

@takluyver
Copy link
Member

If you will only be building against IPython >= 7, you could apply this patch:

93e8d64

@toddrme2178
Copy link
Contributor Author

@takluyver We need to support both python2 and python3 for the time being so we need something that will work for both IPython 7 and IPython 5.

@takluyver
Copy link
Member

takluyver commented Nov 17, 2018 via email

@MSeal
Copy link
Contributor

MSeal commented Aug 9, 2019

Closing as this is unrelated to nbconvert directly and had a work-around posted.

@MSeal MSeal closed this as completed Aug 9, 2019
@t-makaro t-makaro added the workaround known Bug with a known way to get around it label Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround known Bug with a known way to get around it
Projects
None yet
Development

No branches or pull requests

5 participants