From 3f78ffe6d102105e938690c7e953b31df25f5a42 Mon Sep 17 00:00:00 2001 From: Milan <30416311+krneta@users.noreply.github.com> Date: Tue, 15 Aug 2023 14:16:01 -0700 Subject: [PATCH] update: add test for conversion to html (#325) --- test/integ_tests/requirements.txt | 1 + test/integ_tests/test_all_notebooks.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/test/integ_tests/requirements.txt b/test/integ_tests/requirements.txt index 5c9c1ac66..4d4442c75 100644 --- a/test/integ_tests/requirements.txt +++ b/test/integ_tests/requirements.txt @@ -2,6 +2,7 @@ amazon-braket-sdk amazon-braket-pennylane-plugin cvxpy matplotlib +nbconvert pandas pennylane pytest diff --git a/test/integ_tests/test_all_notebooks.py b/test/integ_tests/test_all_notebooks.py index d5ca88839..76a164f7e 100644 --- a/test/integ_tests/test_all_notebooks.py +++ b/test/integ_tests/test_all_notebooks.py @@ -3,6 +3,7 @@ import pytest from testbook import testbook +from nbconvert import HTMLExporter from importlib.machinery import SourceFileLoader # These notebooks have syntax or dependency issues that prevent them from being tested. @@ -74,6 +75,16 @@ def test_all_notebooks(notebook_dir, notebook_file, mock_level): test_mocks.post_run(tb) +@pytest.mark.parametrize("notebook_dir, notebook_file", test_notebooks) +def test_notebook_to_html_conversion(notebook_dir, notebook_file, mock_level): + os.chdir(root_path) + os.chdir(notebook_dir) + + html_exporter = HTMLExporter(template_name='classic') + + html_exporter.from_file(notebook_file) + + def test_record(): # Set the path here to record results. notebook_file_search = ""