Skip to content

Commit

Permalink
Merge branch 'main' into fix/bbs-context
Browse files Browse the repository at this point in the history
  • Loading branch information
dbluhm committed Jan 31, 2024
2 parents f3fbbd5 + 78ffd67 commit a8fe7ce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aries_cloudagent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
CredentialRevocationState,
Presentation,
PresentCredentials,
create_link_secret,
)
from anoncreds.bindings import create_link_secret
from aries_askar import AskarError, AskarErrorCode

from ..anoncreds.models.anoncreds_schema import AnonCredsSchema
Expand Down
25 changes: 25 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ def stub_indy() -> Stub:
return Stub(mock.patch.dict(sys.modules, modules))


def stub_anoncreds() -> Stub:
# detect anoncreds library
try:
from anoncreds import generate_nonce

_ = generate_nonce()
return Stub(None)
except ImportError:
print("Skipping Anoncreds-specific tests: anoncreds module not installed.")
except OSError:
print(
"Skipping Anoncreds-specific tests: anoncreds shared library"
"could not be loaded."
)

modules = {}
package_name = "anoncreds"
modules[package_name] = mock.MagicMock()
return Stub(mock.patch.dict(sys.modules, modules))


def stub_askar() -> Stub:
# detect aries-askar library
try:
Expand Down Expand Up @@ -177,6 +198,7 @@ def pytest_sessionstart(session):

STUBS.update(
{
"anoncreds": stub_anoncreds(),
"askar": stub_askar(),
"indy": stub_indy(),
"indy_credx": stub_indy_credx(),
Expand All @@ -199,6 +221,9 @@ def pytest_sessionfinish(session):
def pytest_runtest_setup(item: pytest.Item):
global STUBS

if tuple(item.iter_markers(name="anoncreds")) and not STUBS["anoncreds"].found:
pytest.skip("test requires Anoncreds support")

if tuple(item.iter_markers(name="askar")) and not STUBS["askar"].found:
pytest.skip("test requires Askar support")

Expand Down

0 comments on commit a8fe7ce

Please sign in to comment.