Skip to content

Commit

Permalink
tests: SimpleFileBasedPolicyEngine: gracefully handle errors on state…
Browse files Browse the repository at this point in the history
…ment read failure

Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
  • Loading branch information
pdxjohnny committed Nov 20, 2023
1 parent 0d6c224 commit 3943d28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scitt_emulator/scitt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def connect_signals(self):
async def signal_receiver_submit_claim(self, _sender, claim: bytes) -> None:
use_lro = self.service_parameters.get("use_lro", False)
result = await self.submit_claim(claim, long_running=use_lro)
while use_lro and result["status"] == "running":
while use_lro and result.get("status", None) == "running":
result = await self._finish_operation(result)

@abstractmethod
Expand Down
14 changes: 13 additions & 1 deletion tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
import copy
import types
import pathlib
import logging
import tempfile
import textwrap
import threading
import itertools
import traceback
import subprocess
import contextlib
import urllib.parse

import myst_parser.parsers.docutils_
Expand All @@ -33,6 +36,8 @@
create_flask_app_oidc_server,
)

logger = logging.getLogger(__name__)


repo_root = pathlib.Path(__file__).parents[1]
docs_dir = repo_root.joinpath("docs")
Expand Down Expand Up @@ -88,7 +93,14 @@ def poll_workspace(config, stop_event):
while running:
for cose_path in operations_path.glob("*.cose"):
denial = copy.deepcopy(CLAIM_DENIED_ERROR)
with open(cose_path, "rb") as stdin_fileobj:
with contextlib.ExitStack() as exit_stack:
try:
stdin_fileobj = exit_stack.enter_context(
open(cose_path, "rb"),
)
except:
logger.error(traceback.format_exc())
continue
env = {
**os.environ,
"SCHEMA_PATH": str(config["schema_path"].resolve()),
Expand Down

0 comments on commit 3943d28

Please sign in to comment.