Skip to content

Commit

Permalink
sphinx_gallery optional for testing
Browse files Browse the repository at this point in the history
sphinx_gallery requires matplotlib, which at the current time fails to install on pypy
  • Loading branch information
mwouts committed Mar 23, 2019
1 parent c578872 commit 91e616b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ install:
# install black if available (Python 3.6 and above), and autopep8 for testing the pipe mode
- pip install black || true
- pip install autopep8 || true
# install sphinx_gallery and matplotlib if available (may not work on pypy)
- pip install sphinx_gallery || true
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
Expand Down
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ pytest
pytest-cov==2.5.1
codecov
notebook
sphinx_gallery
recommonmark
3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from jupytext.compare import compare_notebooks
from jupytext.paired_paths import paired_paths
from jupytext.formats import long_form_one_format, JupytextFormatError
from .utils import list_notebooks, requires_black, requires_flake8, skip_if_dict_is_not_ordered
from .utils import list_notebooks, requires_black, requires_flake8, requires_sphinx_gallery, skip_if_dict_is_not_ordered


def test_str2bool():
Expand Down Expand Up @@ -739,6 +739,7 @@ def test_cli_sync_file_with_suffix(tmpdir):
assert open(tmp_rmd).read().splitlines()[-4:] == ['', '```{python}', '1+1', '```']


@requires_sphinx_gallery
def test_rst2md(tmpdir):
tmp_py = str(tmpdir.join('notebook.py'))
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from jupytext.header import header_to_metadata_and_cell
from jupytext.formats import read_format_from_metadata, auto_ext_from_metadata
from jupytext.contentsmanager import kernelspec_from_language
from .utils import list_notebooks
from .utils import skip_if_dict_is_not_ordered
from .utils import list_notebooks, requires_sphinx_gallery, skip_if_dict_is_not_ordered


def test_create_contentsmanager():
Expand Down Expand Up @@ -960,6 +959,7 @@ def test_pair_notebook_in_dotdot_folder(tmpdir):
cm.get('scripts/notebook_name.py')


@requires_sphinx_gallery
def test_rst2md_option(tmpdir):
tmp_py = str(tmpdir.join('notebook.py'))

Expand Down
2 changes: 2 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import pytest
from jupytext.cli import system
from jupytext.cell_reader import rst2md

skip_if_dict_is_not_ordered = pytest.mark.skipif(
sys.version_info < (3, 6),
Expand All @@ -19,6 +20,7 @@ def tool_version(tool):
requires_black = pytest.mark.skipif(not tool_version('black'), reason='black not found')
requires_flake8 = pytest.mark.skipif(not tool_version('flake8'), reason='flake8 not found')
requires_autopep8 = pytest.mark.skipif(not tool_version('autopep8'), reason='autopep8 not found')
requires_sphinx_gallery = pytest.mark.skipif(not rst2md, reason='sphinx_gallery not available')


def list_notebooks(path='ipynb', skip='World'):
Expand Down

0 comments on commit 91e616b

Please sign in to comment.