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

Add sphinx gallery #384

Merged
merged 59 commits into from Dec 12, 2022
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7bcbea9
get a basic gallery running
FirefoxMetzger Nov 9, 2022
06bc73e
make tests pick up subfolders
FirefoxMetzger Nov 9, 2022
050212a
add pgfx scraper for gallery (temporarily in root)
FirefoxMetzger Nov 9, 2022
bbcb42e
modify cube example to create scraper
FirefoxMetzger Nov 9, 2022
0be1797
avoid freezing during example generation
FirefoxMetzger Nov 10, 2022
6986c9e
start converting examples
FirefoxMetzger Nov 10, 2022
76904f3
convert some examples to sphinx gallery items
FirefoxMetzger Nov 10, 2022
3410714
rewrite more examples
FirefoxMetzger Nov 11, 2022
3c60a84
rename final examples
FirefoxMetzger Nov 11, 2022
c631e03
titles for Qt examples
FirefoxMetzger Nov 11, 2022
eab0437
update model paths in examples
FirefoxMetzger Nov 12, 2022
e3bee5f
styling (flake & black)
FirefoxMetzger Nov 12, 2022
95b4b37
Merge branch 'main' into sphinx-docs
FirefoxMetzger Nov 26, 2022
ec8dba3
introduce config comments
FirefoxMetzger Nov 27, 2022
026912e
update introductory examples
FirefoxMetzger Nov 27, 2022
f984904
fix broken gallery examples
FirefoxMetzger Nov 27, 2022
42f7f3e
add gallery render comment to examples
FirefoxMetzger Nov 27, 2022
099b605
sort new example
FirefoxMetzger Nov 27, 2022
1d19b0e
reorganize page layout
FirefoxMetzger Nov 27, 2022
1e02ffd
update path to validation examples
FirefoxMetzger Nov 27, 2022
4bf5f56
install lavapipe in doc builds
FirefoxMetzger Nov 27, 2022
cac81df
add matplotlib dependency
FirefoxMetzger Nov 27, 2022
121fa15
add example dependencies
FirefoxMetzger Nov 27, 2022
d0769f7
rename validation images to match filename
FirefoxMetzger Nov 28, 2022
5e040c9
animate cube example
FirefoxMetzger Nov 29, 2022
c973c2a
Merge remote-tracking branch 'upstream/main' into sphinx-docs
FirefoxMetzger Nov 29, 2022
2466a03
mokeypatch run when building the gallery
FirefoxMetzger Dec 2, 2022
247c977
blackify
FirefoxMetzger Dec 2, 2022
4948012
Merge branch 'main' into sphinx-docs
FirefoxMetzger Dec 2, 2022
51e797a
prefer apt-get over apt in CI
FirefoxMetzger Dec 2, 2022
8f446f1
move doc requirements into setup.py
FirefoxMetzger Dec 2, 2022
c1cd522
add read-the-docs config
FirefoxMetzger Dec 2, 2022
f60b062
blackify
FirefoxMetzger Dec 2, 2022
50c0172
add a whitespace to not break RTD :)
FirefoxMetzger Dec 2, 2022
cd6bfff
make pre-build steps a list
FirefoxMetzger Dec 2, 2022
c57478f
no longer need ref to requirements.txt
FirefoxMetzger Dec 2, 2022
a3de57a
test using sudo to counter permission error
FirefoxMetzger Dec 2, 2022
b0511cd
add apt packages directly (long shot)
FirefoxMetzger Dec 5, 2022
30590dc
fix RTD config
FirefoxMetzger Dec 5, 2022
d67a813
fix typo
FirefoxMetzger Dec 5, 2022
9a5cdfa
build on ubuntu 22.04
FirefoxMetzger Dec 6, 2022
6ae607b
try add PPA as pre-sys-dependency step
FirefoxMetzger Dec 6, 2022
05cc318
make it a list
FirefoxMetzger Dec 6, 2022
60e7b3e
try the deb approach instead
FirefoxMetzger Dec 6, 2022
5337c7f
don't build heavy example (maybe OOM segfault?)
FirefoxMetzger Dec 6, 2022
56be2b0
undo changes to config file
FirefoxMetzger Dec 6, 2022
8fa1b31
Merge branch 'main' into sphinx-docs
FirefoxMetzger Dec 6, 2022
c9d6472
check if target is a canvas
FirefoxMetzger Dec 7, 2022
c9018ce
conditionally import imageio
FirefoxMetzger Dec 7, 2022
763120c
add webp support in animations
FirefoxMetzger Dec 7, 2022
c6943bd
blackify
FirefoxMetzger Dec 7, 2022
fb47958
less cryptic duration value
FirefoxMetzger Dec 7, 2022
8e0bf31
lossless compression for WEBP
FirefoxMetzger Dec 7, 2022
2e3345c
move _get_sg_image_scraper into __init__
FirefoxMetzger Dec 7, 2022
60e43f7
reorganize scraper imports
FirefoxMetzger Dec 7, 2022
7e67e14
Merge branch 'main' into sphinx-docs
FirefoxMetzger Dec 12, 2022
99ba4cb
use parameterize's ids
FirefoxMetzger Dec 12, 2022
db34c30
blackify
FirefoxMetzger Dec 12, 2022
16d2439
update validation paths
FirefoxMetzger Dec 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 38 additions & 7 deletions examples/tests/test_examples.py
Expand Up @@ -24,20 +24,34 @@


# run all tests unless they opt-out
examples_to_run = find_examples(
negative_query="# run_example = false", return_stems=True
)
examples_to_run_dict = {
path.stem: path for path in find_examples(negative_query="# run_example = false")
}
examples_to_run = [x for x in examples_to_run_dict.keys()]

# only test output of examples that opt-in
examples_to_test = find_examples(query="# test_example = true", return_stems=True)
examples_to_test_dict = {
path.stem: path for path in find_examples(query="# test_example = true")
}
examples_to_test = [x for x in examples_to_test_dict.keys()]


@pytest.mark.parametrize("module", examples_to_run)
FirefoxMetzger marked this conversation as resolved.
Show resolved Hide resolved
def test_examples_run(module, force_offscreen, disable_call_later_after_run):
"""Run every example marked to see if they can run without error."""
# use runpy so the module is not actually imported (and can be gc'd)
# but also to be able to run the code in the __main__ block
runpy.run_module(f"examples.{module}", run_name="__main__")

# (relative) module name from project root
module_name = (
examples_to_run_dict[module]
.relative_to(ROOT)
.with_suffix("")
.as_posix()
.replace("/", ".")
)

runpy.run_module(module_name, run_name="__main__")


@pytest.fixture
Expand Down Expand Up @@ -101,8 +115,25 @@ def test_examples_screenshots(
):
"""Run every example marked for testing."""

# render
example = importlib.import_module(f"examples.validation.{module}")
# (relative) module name from project root
module_name = (
examples_to_test_dict[module]
.relative_to(ROOT)
.with_suffix("")
.as_posix()
.replace("/", ".")
)

# import the example module
example = importlib.import_module(module_name)

# ensure it is unloaded after the test
def unload_module():
del sys.modules[module_name]

request.addfinalizer(unload_module)

# render a frame
img = example.renderer.target.draw()

# check if _something_ was rendered
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.