Skip to content

Commit

Permalink
update test paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanchengyan committed Aug 10, 2024
1 parent 3f46652 commit 0dafdfb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
23 changes: 15 additions & 8 deletions tests/test_gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from myst_sphinx_gallery import gallery, generate_gallery
from myst_sphinx_gallery import gallery, generate_gallery, GalleryConfig


@pytest.fixture
Expand All @@ -26,13 +26,20 @@ def example_header_file(examples_dir):
return examples_dir / "GALLERY_HEADER.rst"


def test_parse_config():
pass


def test_generate_gallery(examples_dir, gallery_dir):
generate_gallery(examples_dir, gallery_dir)
assert (gallery_dir / "index.rst").exists()
@pytest.fixture
def gallery_config(examples_dir, gallery_dir, cwd):
return GalleryConfig(
examples_dirs=[examples_dir],
gallery_dirs=[gallery_dir],
root_dir=cwd.parent,
)


def test_generate_gallery(gallery_config):
generate_gallery(gallery_config)
index_file = gallery_config.gallery_dirs[0] / "index.rst"
print(index_file)
assert index_file.exists()


def test_get_rst_title(example_header_file):
Expand Down
15 changes: 7 additions & 8 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
@pytest.fixture
def cell_nb_file():
cwd = Path(__file__).parent
nb_file = cwd.parent / "examples/code_markdown/plot_image.ipynb"
nb_file = cwd.parent / "examples/code_markdown/plot_image_code.ipynb"
return nb_file


@pytest.fixture
def markdown_nb_file():
cwd = Path(__file__).parent
nb_file = cwd.parent / "examples/02-first_last/image_url_nb_fl.ipynb"
nb_file = cwd.parent / "examples/00-alt/nb.ipynb"
return nb_file


Expand Down Expand Up @@ -96,18 +96,18 @@ def rst_content():
.. image:: img/fun-fish.png
:alt: gallery_thumbnail
:align: center
Secondary alt text
.. image:: img/fun-fish.png
:align: center
:alt: gallery_thumbnail
No alt text
.. image:: img/fun-fish.png
:align: center
Figure syntax
-------------
Expand All @@ -116,13 +116,13 @@ def rst_content():
.. figure:: img/fun-fish.png
:alt: gallery_thumbnail
:align: center
Secondary alt text
.. figure:: img/fun-fish.png
:align: center
:alt: gallery_thumbnail
No alt text
.. figure:: img/fun-fish.png
Expand Down Expand Up @@ -170,4 +170,3 @@ def test_read_markdown_image(markdown_nb_file):
md_content = f.read()
images = parse_md_images(md_content)
print(images.images)
print(md_content)

0 comments on commit 0dafdfb

Please sign in to comment.