From af288aa3675ea88033231cc4d034ebd3902f2288 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Wed, 17 Jan 2024 20:41:33 +0800 Subject: [PATCH] update readme --- README.md | 17 ++++++++++++++--- tests/test_api_version.py | 7 ++++--- tests/test_read_all_examples.py | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4bff193d..a5c948e8 100644 --- a/README.md +++ b/README.md @@ -120,10 +120,21 @@ schema used by the API at sparc.sparc_json_api.default_json_api ``` The schema file is generated from SPARC's LaTeX documentation. In -upcoming releases of `SPARC-X-API`, we're aiming to provide users -the flexibility to use their own custom schema files. This would be +upcoming releases of `SPARC-X-API`, we're aiming to provide users the +flexibility to use their own custom schema files. This would be particularly useful for those who might be testing a development -branch of SPARC. +branch of SPARC. By default, the JSON schema is packaged under +`sparc/sparc_json_api` directory. If you have another version of SPARC +source code, you can set the environment variable `$SPARC_DOC_PATH` to +the directory containing the LaTeX codes for the documentation, such +as `/doc/.LaTeX`. If you obtain `sparc-x` from +the conda method as mentioned above, By default, the JSON schema is +packaged under `sparc/sparc_json_api` directory. If you have another +version of SPARC source code, you can set the environment variable +`$SPARC_DOC_PATH` is automatically set to +`/share/doc/sparc/.LaTeX`. Setting up the environment +variable `$SPARC_DOC_PATH` helps loading the correct JSON schame that +is compatible with your SPARC binary code. ### C) SPARC Command Configuration diff --git a/tests/test_api_version.py b/tests/test_api_version.py index a0a6f7d0..bf7e8189 100644 --- a/tests/test_api_version.py +++ b/tests/test_api_version.py @@ -19,8 +19,8 @@ def test_sparc_api(monkeypatch): older_ver = locate_api(doc_path=curdir / "sparc-latex-doc-202302").sparc_version assert older_ver is None # Specify SPARC_DOC_PATH - monkeypatch.setenv("SPARC_DOC_PATH", - (curdir / "sparc-latex-doc-202302").resolve().as_posix() + monkeypatch.setenv( + "SPARC_DOC_PATH", (curdir / "sparc-latex-doc-202302").resolve().as_posix() ) older_version = locate_api().sparc_version assert older_version is None @@ -29,8 +29,9 @@ def test_sparc_api(monkeypatch): def test_sparc_params(): if "SPARC_DOC_PATH" not in os.environ: pytest.skip(msg="No $SPARC_DOC_PATH set. Skip") - + from sparc.utils import locate_api + # Use the default api with SPARC_DOC_PATH api = locate_api() if api.sparc_version is None: diff --git a/tests/test_read_all_examples.py b/tests/test_read_all_examples.py index bd6d8cd3..3ce67d86 100644 --- a/tests/test_read_all_examples.py +++ b/tests/test_read_all_examples.py @@ -38,6 +38,7 @@ def test_read_all_tests(): from sparc.io import read_sparc from sparc.utils import locate_api import os + print("SPARC_DOC_PATH is: ", os.environ.get("SPARC_DOC_PATH", None)) api = locate_api() print(api.sparc_version)