diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 965fc0a..1864a73 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -93,10 +93,8 @@ jobs: run: | export path_to_file=$(find dist -type f -name "problem_bank_scripts-*.${{ matrix.dist.extension }}") echo "::notice::Installing ${{ matrix.dist.name }}: $path_to_file" - python -m pip install --user $path_to_file + python -m pip install --user "$path_to_file[tests]" python -m pip list - - name: Install test dependencies - run: python -m pip install --user pytest fastjsonschema - name: Run tests against installed wheel run: rm -rf src/ && pytest tests/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73e8eb3..8ae757e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -94,7 +94,7 @@ jobs: cache: poetry - name: Install dependencies run: | - poetry install --with dev + poetry install -E tests - name: Run tests run: | poetry run pytest tests diff --git a/poetry.lock b/poetry.lock index 2e0be84..966a556 100644 --- a/poetry.lock +++ b/poetry.lock @@ -871,7 +871,7 @@ test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "p name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, @@ -1701,13 +1701,13 @@ files = [ [[package]] name = "openai" -version = "1.37.0" +version = "1.37.1" description = "The official Python library for the openai API" optional = true python-versions = ">=3.7.1" files = [ - {file = "openai-1.37.0-py3-none-any.whl", hash = "sha256:a903245c0ecf622f2830024acdaa78683c70abb8e9d37a497b851670864c9f73"}, - {file = "openai-1.37.0.tar.gz", hash = "sha256:dc8197fc40ab9d431777b6620d962cc49f4544ffc3011f03ce0a805e6eb54adb"}, + {file = "openai-1.37.1-py3-none-any.whl", hash = "sha256:9a6adda0d6ae8fce02d235c5671c399cfa40d6a281b3628914c7ebf244888ee3"}, + {file = "openai-1.37.1.tar.gz", hash = "sha256:faf87206785a6b5d9e34555d6a3242482a6852bc802e453e2a891f68ee04ce55"}, ] [package.dependencies] @@ -1988,7 +1988,7 @@ type = ["mypy (>=1.8)"] name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, @@ -2249,13 +2249,13 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" -version = "8.3.1" +version = "8.3.2" description = "pytest: simple powerful testing with Python" -optional = false +optional = true python-versions = ">=3.8" files = [ - {file = "pytest-8.3.1-py3-none-any.whl", hash = "sha256:e9600ccf4f563976e2c99fa02c7624ab938296551f280835ee6516df8bc4ae8c"}, - {file = "pytest-8.3.1.tar.gz", hash = "sha256:7e8e5c5abd6e93cb1cc151f23e57adc31fcf8cfd2a3ff2da63e23f732de35db6"}, + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, ] [package.dependencies] @@ -3369,9 +3369,10 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [extras] docs = ["Sphinx", "ipykernel", "myst-nb", "myst-parser", "nbsphinx", "sphinx-rtd-theme"] +tests = ["fastjsonschema", "pytest"] tui = ["nltk", "openai", "pdf2image", "python-dotenv", "questionary", "scikit-learn"] [metadata] lock-version = "2.0" python-versions = ">=3.10" -content-hash = "98cfab6232b65f68559920e422a5aabb3b9b4c177230c5f88b410faf86d3ca90" +content-hash = "31558ee17b93f9d0e03dcb4390970ccc8b1f0873088b0226593e6cf7fbdd915c" diff --git a/pyproject.toml b/pyproject.toml index f307ebf..fec7afe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,13 +38,13 @@ ipykernel = {version = "^6.29.5", optional = true} sphinx-rtd-theme = {version = "^2.0.0", optional = true} myst-nb = {version = "^1.1.1", optional = true} myst-parser = {version = "^3.0.1", optional = true} +pytest = {version = "^8.2.2", optional = true} +fastjsonschema = {version = "^2.20.0", optional = true} [tool.poetry.extras] tui = ["questionary", "nltk", "openai", "pdf2image", "scikit-learn", "python-dotenv"] docs = ["Sphinx", "nbsphinx", "ipykernel", "sphinx-rtd-theme", "myst-nb", "myst-parser"] - -[tool.poetry.group.dev.dependencies] -pytest = "^8.2.2" +tests = ["pytest", "fastjsonschema"] [tool.poetry.scripts] pbs-cli = "problem_bank_scripts.scripts.cli:main" @@ -54,6 +54,5 @@ process = "problem_bank_scripts.scripts.process:main" process_q = "problem_bank_scripts.scripts.process_q:main" checkq = "problem_bank_scripts.scripts.check_question:main" - [tool.pytest.ini_options] filterwarnings = ["error", "ignore::DeprecationWarning:problem_bank_helpers"] diff --git a/src/problem_bank_scripts/tui/write_md.py b/src/problem_bank_scripts/tui/write_md.py index 3f5f083..286d400 100644 --- a/src/problem_bank_scripts/tui/write_md.py +++ b/src/problem_bank_scripts/tui/write_md.py @@ -258,7 +258,7 @@ def write_code(exercise: dict): for i, table in enumerate(exercise["tables"], start=1): lines.append(f"table{i} = {table['matrix']}") lines.append( - f'data2["params"]["table{i}"] = pbh.create_html_table(table{i+1}, width="550px", ' + f'data2["params"]["table{i}"] = pbh.create_html_table(table{i}, width="550px", ' f'first_row_is_header={table.get("first_row_is_header", True)}, first_col_is_header={table.get("first_col_is_header", False)},)' )