diff --git a/src/sphinx_data_viewer/sphinx_data_viewer.py b/src/sphinx_data_viewer/sphinx_data_viewer.py index fe97bf3..40664f2 100644 --- a/src/sphinx_data_viewer/sphinx_data_viewer.py +++ b/src/sphinx_data_viewer/sphinx_data_viewer.py @@ -50,7 +50,10 @@ def install_lib_static_files(app: Sphinx, env) -> None: statics_dir = Path(app.builder.outdir) / "_static" source_dir = Path(__file__).parent / "assets" destination_dir = statics_dir / "sphinx-data-viewer" - copy_asset(str(source_dir), str(destination_dir)) + if sphinx_version >= (8, 0): + copy_asset(str(source_dir), str(destination_dir), force=True) + else: + copy_asset(str(source_dir), str(destination_dir)) lib_path = Path("sphinx-data-viewer") _add_js_file(app, lib_path.joinpath("jsonview.bundle.js")) diff --git a/tests/test_basic.py b/tests/test_basic.py index 896d3c3..cb6e782 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -17,14 +17,17 @@ def test_build(builder: str, tmp_path: Path, make_app: type[SphinxTestApp]): It looks like that there are scenarios where this specific build makes trouble but no others. """ tmp_path.joinpath("conf.py").write_text( - dedent("""\ + dedent( + """\ extensions = ["sphinx_data_viewer"] - """), + """ + ), encoding="utf-8", ) tmp_path.joinpath("test.json").write_text('{"a": [1, 2, 3]}', encoding="utf-8") tmp_path.joinpath("index.rst").write_text( - dedent("""\ + dedent( + """\ Title ===== @@ -35,7 +38,8 @@ def test_build(builder: str, tmp_path: Path, make_app: type[SphinxTestApp]): .. data-viewer:: :file: test.json - """), + """ + ), encoding="utf-8", )