Skip to content

Commit

Permalink
test: Adjust ignored code for coverage calculation
Browse files Browse the repository at this point in the history
Adjust ignored code for coverage calculation. Completes
work started in commit 5417907.
  • Loading branch information
riddell-stan committed Dec 1, 2020
1 parent 7433dfd commit caf8159
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python -m pip install dist/*.whl
- name: Run tests
run: "python -m pytest -s -v --cov=httpstan tests"
run: python -m pytest -s -v --cov=httpstan tests

- name: Test PyStan compatibility
run: |
Expand Down
2 changes: 1 addition & 1 deletion httpstan/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async def build_services_extension_module(program_code: str, extra_compile_args:
# where to find shared libraries during execution. There are two ways for an
# extension module to find shared libraries: LD_LIBRARY_PATH and rpath.
libraries = ["sundials_cvodes", "sundials_idas", "sundials_nvecserial", "tbb"]
if platform.system() == "Darwin":
if platform.system() == "Darwin": # pragma: no cover
libraries.extend(["tbbmalloc", "tbbmalloc_proxy"])
extension = setuptools.Extension(
f"stan_services_{stan_model_name}", # filename only. Module name is "stan_services"
Expand Down
4 changes: 2 additions & 2 deletions httpstan/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Operation(marshmallow.Schema):
@marshmallow.validates_schema
def validate_result(self, data: dict, many: bool, partial: bool) -> None:
assert not many and not partial, "Use of `many` and `partial` with schema unsupported."
if data["done"] and data.get("result") is None:
if data["done"] and data.get("result") is None: # pragma: no cover
raise marshmallow.ValidationError("If `done` then `result` must be set.", "result")
if not data["done"] and data.get("result"):
if not data["done"] and data.get("result"): # pragma: no cover
raise marshmallow.ValidationError("If not `done` then `result` must be empty.", "result")


Expand Down
2 changes: 1 addition & 1 deletion httpstan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def handle_create_model(request: aiohttp.web.Request) -> aiohttp.web.Respo
try:
# `build_services_extension_module` has side-effect of storing extension module in cache
compiler_output = await httpstan.models.build_services_extension_module(program_code)
except Exception as exc:
except Exception as exc: # pragma: no cover
message, status = (
f"Exception while building model extension module: `{repr(exc)}`, traceback: `{traceback.format_tb(exc.__traceback__)}`",
400,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ known_local_folder = "helpers"

[tool.coverage.run]
branch = true
omit = httpstan/__main__.py
omit = ["httpstan/__main__.py"]

[tool.coverage.report]
fail_under = 95
Expand Down

0 comments on commit caf8159

Please sign in to comment.