-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use descriptor protocol for Param (#83)
- Converted Param to use descriptor protocol - Added --destination to vsk save - Updated all examples - Added a test to run all examples - vsk commands now have exit status of 1 on error condition
- Loading branch information
Showing
15 changed files
with
127 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,4 @@ dmypy.json | |
|
||
/mywork/ | ||
/profile | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import glob | ||
import pathlib | ||
|
||
import nbformat | ||
import pytest | ||
from nbconvert.preprocessors import ExecutePreprocessor | ||
from typer.testing import CliRunner | ||
from vsketch_cli.cli import cli | ||
|
||
EXAMPLES = str(pathlib.Path(__file__).parent.parent.absolute()) + "/examples/_notebooks/" | ||
EXAMPLES = pathlib.Path(__file__).parent.parent.absolute() / "examples" | ||
NOTEBOOKS = EXAMPLES / "_notebooks" | ||
|
||
runner = CliRunner() | ||
|
||
|
||
@pytest.mark.slow | ||
@pytest.mark.parametrize("ipynb", glob.glob(EXAMPLES + "*.ipynb")) | ||
def test_example_detail(tmp_path, ipynb): | ||
@pytest.mark.parametrize("ipynb", NOTEBOOKS.glob("*.ipynb")) | ||
def test_example_notebooks(tmp_path, ipynb): | ||
with open(ipynb) as f: | ||
nb = nbformat.read(f, as_version=4) | ||
ep = ExecutePreprocessor(timeout=600, kernel_name="python3") | ||
ep.preprocess(nb, {"metadata": {"path": tmp_path}}) | ||
|
||
|
||
@pytest.mark.parametrize("path", EXAMPLES.glob("[!._]*[!.md]")) | ||
def test_examples(tmp_path, path): | ||
# Note: split is needed to avoid `invoke`'s preprocessor to eat Windows' path backslashes | ||
res = runner.invoke( | ||
cli, f"save --name test_output --destination {tmp_path} {str(path)}".split() | ||
) | ||
assert res.exit_code == 0 | ||
assert (pathlib.Path(tmp_path) / "test_output.svg").exists() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.