Skip to content

Commit

Permalink
Fix testing and docs build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber authored and speth committed Apr 25, 2023
1 parent c64773d commit d469ab2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy cython sphinx\<4.0 jinja2\<3.1.0 \
sphinxcontrib-katex sphinxcontrib-matlabdomain sphinxcontrib-doxylink
sphinxcontrib-katex sphinxcontrib-matlabdomain sphinxcontrib-doxylink pint
- name: Build Cantera with documentation
run: python3 `which scons` build -j2 doxygen_docs=y sphinx_docs=y debug=n optimize=n use_pch=n
- name: Ensure 'scons help' options work
Expand Down
18 changes: 14 additions & 4 deletions test/python/test_units.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from contextlib import nullcontext
import pytest
from dataclasses import dataclass
from typing import Optional, Tuple, Dict
import sys

import pytest
import cantera.with_units as ctu
import cantera as ct
import numpy as np
from pint.testing import assert_allclose
try:
from pint.testing import assert_allclose
except ModuleNotFoundError:
# pint.testing was introduced in pint 0.20
from pint.testsuite.helpers import assert_quantity_almost_equal as assert_allclose


@pytest.fixture(scope="function")
Expand All @@ -25,7 +29,13 @@ def generic_phase(request):


def test_setting_basis_units_fails(generic_phase):
with pytest.raises(AttributeError, match="basis_units"):
# Python 3.10 includes the name of the attribute which was improperly used as a
# setter. Earlier versions have just a generic error message.
if sys.version_info.minor < 10:
match = "set attribute"
else:
match = "basis_units"
with pytest.raises(AttributeError, match=match):
generic_phase.basis_units = "some random string"


Expand Down

0 comments on commit d469ab2

Please sign in to comment.