Test without __future__ importsΒΆ

Test that __future__ imports inside sphinx_gallery modules does not affect the parsing of this script.

Traceback (most recent call last):
  File "/home/lucy/Documents/sphinx-gallery/sphinx_gallery/gen_gallery.py", line 157, in call_memory
    return 0., func()
  File "/home/lucy/Documents/sphinx-gallery/sphinx_gallery/gen_rst.py", line 461, in __call__
    exec(self.code, self.fake_main.__dict__)
  File "/home/lucy/Documents/sphinx-gallery/sphinx_gallery/tests/tinybuild/examples/future/plot_future_imports_broken.py", line 18, in <module>
    raise RuntimeError('Forcing this example to fail on Python 3')
RuntimeError: Forcing this example to fail on Python 3

import sys
PY3_OR_LATER = sys.version_info[0] >= 3

# SyntaxError on Python 2
print(3/2, end='')

# Need to make this example fail on Python 3 as well (currently no way to say
# that an example is expected to fail only on Python 2)
if PY3_OR_LATER:
    raise RuntimeError('Forcing this example to fail on Python 3')

Total running time of the script: ( 0 minutes 0.001 seconds)

Gallery generated by Sphinx-Gallery