From b277d65abd5f3f2df85240e8f6ed1413f4308e0f Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 10:03:34 +0100 Subject: [PATCH 1/7] Add docrun dependency --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 0b6da165..26c57fb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ optional-dependencies.dev = [ "check-manifest==0.49", "deptry==0.20.0", "doc8==1.1.2", + "doccmd==2024.9.14.5", "freezegun==1.5.1", "furo==2024.8.6", "interrogate==1.7.0", From ab10547df4ee01e8d84f774009d418dcd00aa844 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 10:22:41 +0100 Subject: [PATCH 2/7] Add docrun pre-commit hooks --- .pre-commit-config.yaml | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55d22db3..f8214062 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,6 +66,13 @@ repos: types_or: [python, toml] pass_filenames: false + - id: mypy-docs + name: mypy-docs + stages: [push] + entry: doccmd --language=python --command="mypy" + language: system + types_or: [markdown, rst, python, toml] + - id: check-manifest name: check-manifest stages: [push] @@ -81,6 +88,13 @@ repos: types_or: [python, toml] pass_filenames: false + - id: pyright-docs + name: pyright-docs + stages: [push] + entry: doccmd --language=python --command="pyright" + language: system + types_or: [markdown, rst, python, toml] + - id: vulture name: vulture entry: python -m vulture --min-confidence 100 --exclude .eggs @@ -107,30 +121,61 @@ repos: stages: [manual] pass_filenames: false + - id: pylint-docs + name: pylint-docs + entry: doccmd --language=python --command="pylint" --lowercase-file-name + language: system + stages: [manual] + types_or: [markdown, rst, python, toml] + - id: ruff-check name: Ruff check entry: python -m ruff check language: system types_or: [python] + - id: ruff-check-docs + name: Ruff check docs + entry: doccmd --language=python --command="ruff check" + language: system + types_or: [markdown, rst] + - id: ruff-format-diff name: Ruff format diff entry: python -m ruff format --diff language: system types_or: [python] + - id: ruff-format-diff-docs + name: Ruff format diff docs + entry: doccmd --language=python --no-pad-file --command="ruff format --diff" + language: system + types_or: [markdown, rst] + - id: ruff-check-fix name: Ruff check fix entry: python -m ruff check --fix language: system types_or: [python] + - id: ruff-check-fix-docs + name: Ruff check fix docs + entry: doccmd --language=python --command="ruff check --fix" + language: system + types_or: [markdown, rst] + - id: ruff-format-fix name: Ruff format entry: python -m ruff format language: system types_or: [python] + - id: ruff-format-fix-docs + name: Ruff format docs + entry: doccmd --language=python --no-pad-file --command="ruff format" + language: system + types_or: [markdown, rst] + - id: doc8 name: doc8 entry: python -m doc8 @@ -143,6 +188,12 @@ repos: language: system types_or: [python] + - id: interrogate-docs + name: interrogate docs + entry: doccmd --language=python --command="interrogate" + language: system + types_or: [markdown, rst] + - id: pyproject-fmt-check name: pyproject-fmt check entry: pyproject-fmt --check From 1ed7e80562a03183dc9aad9d8c6a115486fe757e Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 10:24:10 +0100 Subject: [PATCH 3/7] Ignore docs items in pre-commit config --- .pre-commit-config.yaml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8214062..9dbe7b74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,25 +6,32 @@ ci: # We therefore cannot use those dependencies in pre-commit CI. skip: - actionlint - - mypy - check-manifest - - pyright - - vulture - - pyroma - deptry - - pylint - - ruff-check - - ruff-format-diff - - ruff-check-fix - - ruff-format-fix - doc8 + - docs - interrogate + - interrogate-docs + - linkcheck + - mypy + - mypy-docs + - pylint - pyproject-fmt-check - pyproject-fmt-fix - - linkcheck - - spelling - - docs + - pyright + - pyright-docs - pyright-verifytypes + - pyroma + - ruff-check + - ruff-check-docs + - ruff-check-fix + - ruff-check-fix-docs + - ruff-format-diff + - ruff-format-diff-docs + - ruff-format-fix + - ruff-format-fix-docs + - spelling + - vulture default_install_hook_types: [pre-commit, pre-push, commit-msg] repos: From 5113f9d641926c5a249bf2a8c0695e0476b71bad Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sun, 15 Sep 2024 09:24:38 +0000 Subject: [PATCH 4/7] [pre-commit.ci lite] apply automatic fixes --- README.rst | 14 ++++++------ docs/source/index.rst | 53 ++++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/README.rst b/README.rst index 0f54838e..aca061a0 100644 --- a/README.rst +++ b/README.rst @@ -26,10 +26,10 @@ Getting Started from vws import VWS, CloudRecoService - server_access_key = '[server-access-key]' - server_secret_key = '[server-secret-key]' - client_access_key = '[client-access-key]' - client_secret_key = '[client-secret-key]' + server_access_key = "[server-access-key]" + server_secret_key = "[server-secret-key]" + client_access_key = "[client-access-key]" + client_secret_key = "[client-secret-key]" vws_client = VWS( server_access_key=server_access_key, @@ -39,10 +39,10 @@ Getting Started client_access_key=client_access_key, client_secret_key=client_secret_key, ) - name = 'my_image_name' + name = "my_image_name" - image = pathlib.Path('high_quality_image.jpg') - with image.open(mode='rb') as my_image_file: + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: target_id = vws_client.add_target( name=name, width=1, diff --git a/docs/source/index.rst b/docs/source/index.rst index 907096d1..b81c4c9b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,10 +22,10 @@ See the :doc:`api-reference` for full usage details. from vws import VWS, CloudRecoService - server_access_key = '[server-access-key]' - server_secret_key = '[server-secret-key]' - client_access_key = '[client-access-key]' - client_secret_key = '[client-secret-key]' + server_access_key = "[server-access-key]" + server_secret_key = "[server-secret-key]" + client_access_key = "[client-access-key]" + client_secret_key = "[client-secret-key]" vws_client = VWS( server_access_key=server_access_key, @@ -36,19 +36,20 @@ See the :doc:`api-reference` for full usage details. client_secret_key=client_secret_key, ) import uuid - name = 'my_image_name' + uuid.uuid4().hex - - image = pathlib.Path('high_quality_image.jpg') - with image.open(mode='rb') as my_image_file: - target_id = vws_client.add_target( - name=name, - width=1, - image=my_image_file, - active_flag=True, - application_metadata=None, - ) - vws_client.wait_for_target_processed(target_id=target_id) - matching_targets = cloud_reco_client.query(image=my_image_file) + + name = "my_image_name" + uuid.uuid4().hex + + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name=name, + width=1, + image=my_image_file, + active_flag=True, + application_metadata=None, + ) + vws_client.wait_for_target_processed(target_id=target_id) + matching_targets = cloud_reco_client.query(image=my_image_file) assert matching_targets[0].target_id == target_id a = 1 @@ -84,15 +85,15 @@ To write unit tests for code which uses this library, without using your Vuforia client_secret_key=database.client_secret_key, ) - image = pathlib.Path('high_quality_image.jpg') - with image.open(mode='rb') as my_image_file: - target_id = vws_client.add_target( - name="example_image_name", - width=1, - image=my_image_file, - application_metadata=None, - active_flag=True, - ) + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name="example_image_name", + width=1, + image=my_image_file, + application_metadata=None, + active_flag=True, + ) There are some differences between the mock and the real Vuforia. See https://vws-python-mock.readthedocs.io/en/latest/differences-to-vws.html for details. From a97247ce488dad4376435cc421c375bb4a66bd4c Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 10:37:44 +0100 Subject: [PATCH 5/7] Fix many lint issues --- .pre-commit-config.yaml | 2 ++ README.rst | 7 ++++++- docs/source/index.rst | 13 +++++++++---- pyproject.toml | 5 +++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9dbe7b74..77321e83 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,5 @@ +fail_fast: true + # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks diff --git a/README.rst b/README.rst index aca061a0..b82abf66 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,10 @@ Getting Started .. code-block:: python + """Add a target to VWS and then query it.""" + import pathlib + import uuid from vws import VWS, CloudRecoService @@ -39,7 +42,8 @@ Getting Started client_access_key=client_access_key, client_secret_key=client_secret_key, ) - name = "my_image_name" + + name = "my_image_name_" + uuid.uuid4().hex image = pathlib.Path("high_quality_image.jpg") with image.open(mode="rb") as my_image_file: @@ -54,6 +58,7 @@ Getting Started matching_targets = cloud_reco_client.query(image=my_image_file) assert matching_targets[0].target_id == target_id + a = 1 Full Documentation ------------------ diff --git a/docs/source/index.rst b/docs/source/index.rst index b81c4c9b..d085bcc8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,7 +18,10 @@ See the :doc:`api-reference` for full usage details. .. code-block:: python + """Add a target to VWS and then query it.""" + import pathlib + import uuid from vws import VWS, CloudRecoService @@ -35,9 +38,8 @@ See the :doc:`api-reference` for full usage details. client_access_key=client_access_key, client_secret_key=client_secret_key, ) - import uuid - name = "my_image_name" + uuid.uuid4().hex + name = "my_image_name_" + uuid.uuid4().hex image = pathlib.Path("high_quality_image.jpg") with image.open(mode="rb") as my_image_file: @@ -67,11 +69,14 @@ To write unit tests for code which uses this library, without using your Vuforia .. code-block:: python + """Test adding a target to VWS.""" + import pathlib - from mock_vws.database import VuforiaDatabase from mock_vws import MockVWS - from vws import CloudRecoService, VWS + from mock_vws.database import VuforiaDatabase + + from vws import VWS, CloudRecoService with MockVWS() as mock: database = VuforiaDatabase() diff --git a/pyproject.toml b/pyproject.toml index 26c57fb1..4e152e40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,6 +123,11 @@ lint.per-file-ignores."conftest.py" = [ "S106", ] +lint.per-file-ignores."doccmd_*.py" = [ + # Allow hardcoded secrets in documentation. + "S105", +] + lint.per-file-ignores."tests/*.py" = [ # Do not require tests to have a one-line summary. "D205", From 74c05e06da166cc3855956669f2e36af16f0b581 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 11:00:04 +0100 Subject: [PATCH 6/7] Progress towards passing lint --- README.rst | 70 +++++++++++++++---------- conftest.py | 33 +++++++++++- docs/source/index.rst | 115 +++++++++++++++++++++++++----------------- 3 files changed, 142 insertions(+), 76 deletions(-) diff --git a/README.rst b/README.rst index b82abf66..9e008dc3 100644 --- a/README.rst +++ b/README.rst @@ -28,37 +28,51 @@ Getting Started import uuid from vws import VWS, CloudRecoService + from vws.reports import QueryResult - server_access_key = "[server-access-key]" - server_secret_key = "[server-secret-key]" - client_access_key = "[client-access-key]" - client_secret_key = "[client-secret-key]" - - vws_client = VWS( - server_access_key=server_access_key, - server_secret_key=server_secret_key, - ) - cloud_reco_client = CloudRecoService( - client_access_key=client_access_key, - client_secret_key=client_secret_key, - ) - - name = "my_image_name_" + uuid.uuid4().hex - - image = pathlib.Path("high_quality_image.jpg") - with image.open(mode="rb") as my_image_file: - target_id = vws_client.add_target( - name=name, - width=1, - image=my_image_file, - active_flag=True, - application_metadata=None, + + def add_target() -> str: + """Add a target to VWS and return its ID.""" + server_access_key = "[server-access-key]" + server_secret_key = "[server-secret-key]" + vws_client = VWS( + server_access_key=server_access_key, + server_secret_key=server_secret_key, + ) + name = "my_image_name_" + uuid.uuid4().hex + + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name=name, + width=1, + image=my_image_file, + active_flag=True, + application_metadata=None, + ) + vws_client.wait_for_target_processed(target_id=target_id) + + return target_id + + + def get_matching_targets() -> list[QueryResult]: + """Query VWS for matching targets.""" + client_access_key = "[client-access-key]" + client_secret_key = "[client-secret-key]" + + cloud_reco_client = CloudRecoService( + client_access_key=client_access_key, + client_secret_key=client_secret_key, ) - vws_client.wait_for_target_processed(target_id=target_id) - matching_targets = cloud_reco_client.query(image=my_image_file) - assert matching_targets[0].target_id == target_id - a = 1 + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + return cloud_reco_client.query(image=my_image_file) + + + TARGET_ID = add_target() + MATCHING_TARGETS = get_matching_targets() + assert MATCHING_TARGETS[0].target_id == TARGET_ID Full Documentation ------------------ diff --git a/conftest.py b/conftest.py index 059fd096..8b12e9d0 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,7 @@ """Setup for Sybil.""" import io +import sys from collections.abc import Generator from doctest import ELLIPSIS from pathlib import Path @@ -12,9 +13,11 @@ from sybil import Sybil from sybil.parsers.rest import ( ClearNamespaceParser, + CodeBlockParser, DocTestParser, PythonCodeBlockParser, ) +from sybil_extras.evaluators.shell_evaluator import ShellCommandEvaluator def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: @@ -67,5 +70,33 @@ def mock_vws() -> Generator[None, None, None]: PythonCodeBlockParser(), ], patterns=["*.rst", "*.py"], - fixtures=["make_image_file", "mock_vws"], ).pytest() + +run_code_sybil = Sybil( + parsers=[ + DocTestParser(optionflags=ELLIPSIS), + PythonCodeBlockParser(), + ], + patterns=["*.rst", "*.py"], + fixtures=["make_image_file", "mock_vws"], +) + +pytest_sybil = Sybil( + parsers=[ + CodeBlockParser( + language="python", + evaluator=ShellCommandEvaluator( + args=[sys.executable, "-m", "pytest"], + tempfile_suffixes=[".py"], + pad_file=True, + write_to_file=False, + ), + ), + ], + patterns=["*.rst"], + fixtures=["make_image_file"], +) + +sybils = run_code_sybil + pytest_sybil + +pytest_collect_file = sybils.pytest() diff --git a/docs/source/index.rst b/docs/source/index.rst index d085bcc8..1861a3de 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -24,37 +24,51 @@ See the :doc:`api-reference` for full usage details. import uuid from vws import VWS, CloudRecoService + from vws.reports import QueryResult - server_access_key = "[server-access-key]" - server_secret_key = "[server-secret-key]" - client_access_key = "[client-access-key]" - client_secret_key = "[client-secret-key]" - - vws_client = VWS( - server_access_key=server_access_key, - server_secret_key=server_secret_key, - ) - cloud_reco_client = CloudRecoService( - client_access_key=client_access_key, - client_secret_key=client_secret_key, - ) - - name = "my_image_name_" + uuid.uuid4().hex - - image = pathlib.Path("high_quality_image.jpg") - with image.open(mode="rb") as my_image_file: - target_id = vws_client.add_target( - name=name, - width=1, - image=my_image_file, - active_flag=True, - application_metadata=None, + + def add_target() -> str: + """Add a target to VWS and return its ID.""" + server_access_key = "[server-access-key]" + server_secret_key = "[server-secret-key]" + vws_client = VWS( + server_access_key=server_access_key, + server_secret_key=server_secret_key, + ) + name = "my_image_name_" + uuid.uuid4().hex + + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name=name, + width=1, + image=my_image_file, + active_flag=True, + application_metadata=None, + ) + vws_client.wait_for_target_processed(target_id=target_id) + + return target_id + + + def get_matching_targets() -> list[QueryResult]: + """Query VWS for matching targets.""" + client_access_key = "[client-access-key]" + client_secret_key = "[client-secret-key]" + + cloud_reco_client = CloudRecoService( + client_access_key=client_access_key, + client_secret_key=client_secret_key, ) - vws_client.wait_for_target_processed(target_id=target_id) - matching_targets = cloud_reco_client.query(image=my_image_file) - assert matching_targets[0].target_id == target_id - a = 1 + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + return cloud_reco_client.query(image=my_image_file) + + + TARGET_ID = add_target() + MATCHING_TARGETS = get_matching_targets() + assert MATCHING_TARGETS[0].target_id == TARGET_ID Testing ------- @@ -78,27 +92,34 @@ To write unit tests for code which uses this library, without using your Vuforia from vws import VWS, CloudRecoService - with MockVWS() as mock: - database = VuforiaDatabase() - mock.add_database(database=database) - vws_client = VWS( - server_access_key=database.server_access_key, - server_secret_key=database.server_secret_key, - ) - cloud_reco_client = CloudRecoService( - client_access_key=database.client_access_key, - client_secret_key=database.client_secret_key, - ) - image = pathlib.Path("high_quality_image.jpg") - with image.open(mode="rb") as my_image_file: - target_id = vws_client.add_target( - name="example_image_name", - width=1, - image=my_image_file, - application_metadata=None, - active_flag=True, + def test_add_target() -> None: + """Test adding a target to VWS.""" + with MockVWS() as mock: + database = VuforiaDatabase() + mock.add_database(database=database) + vws_client = VWS( + server_access_key=database.server_access_key, + server_secret_key=database.server_secret_key, ) + cloud_reco_client = CloudRecoService( + client_access_key=database.client_access_key, + client_secret_key=database.client_secret_key, + ) + + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name="example_image_name", + width=1, + image=my_image_file, + application_metadata=None, + active_flag=True, + ) + + vws_client.wait_for_target_processed(target_id=target_id) + matching_targets = cloud_reco_client.query(image=my_image_file) + assert matching_targets[0].target_id == target_id There are some differences between the mock and the real Vuforia. See https://vws-python-mock.readthedocs.io/en/latest/differences-to-vws.html for details. From 0f41e176a32450fabd4e73ce1fa98b677e9be4e5 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 15 Sep 2024 11:38:01 +0100 Subject: [PATCH 7/7] Progress towards passing lint --- conftest.py | 33 +--------------------- docs/source/index.rst | 66 +++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 63 deletions(-) diff --git a/conftest.py b/conftest.py index 8b12e9d0..059fd096 100644 --- a/conftest.py +++ b/conftest.py @@ -1,7 +1,6 @@ """Setup for Sybil.""" import io -import sys from collections.abc import Generator from doctest import ELLIPSIS from pathlib import Path @@ -13,11 +12,9 @@ from sybil import Sybil from sybil.parsers.rest import ( ClearNamespaceParser, - CodeBlockParser, DocTestParser, PythonCodeBlockParser, ) -from sybil_extras.evaluators.shell_evaluator import ShellCommandEvaluator def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: @@ -70,33 +67,5 @@ def mock_vws() -> Generator[None, None, None]: PythonCodeBlockParser(), ], patterns=["*.rst", "*.py"], -).pytest() - -run_code_sybil = Sybil( - parsers=[ - DocTestParser(optionflags=ELLIPSIS), - PythonCodeBlockParser(), - ], - patterns=["*.rst", "*.py"], fixtures=["make_image_file", "mock_vws"], -) - -pytest_sybil = Sybil( - parsers=[ - CodeBlockParser( - language="python", - evaluator=ShellCommandEvaluator( - args=[sys.executable, "-m", "pytest"], - tempfile_suffixes=[".py"], - pad_file=True, - write_to_file=False, - ), - ), - ], - patterns=["*.rst"], - fixtures=["make_image_file"], -) - -sybils = run_code_sybil + pytest_sybil - -pytest_collect_file = sybils.pytest() +).pytest() diff --git a/docs/source/index.rst b/docs/source/index.rst index 1861a3de..912cddc1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -83,43 +83,47 @@ To write unit tests for code which uses this library, without using your Vuforia .. code-block:: python - """Test adding a target to VWS.""" + """Add a target to VWS and then query it.""" - import pathlib + import pathlib - from mock_vws import MockVWS - from mock_vws.database import VuforiaDatabase + from mock_vws import MockVWS + from mock_vws.database import VuforiaDatabase - from vws import VWS, CloudRecoService + from vws import VWS, CloudRecoService - def test_add_target() -> None: - """Test adding a target to VWS.""" - with MockVWS() as mock: - database = VuforiaDatabase() - mock.add_database(database=database) - vws_client = VWS( - server_access_key=database.server_access_key, - server_secret_key=database.server_secret_key, - ) - cloud_reco_client = CloudRecoService( - client_access_key=database.client_access_key, - client_secret_key=database.client_secret_key, - ) + def test_add_target() -> None: + """Test adding a target to VWS.""" + with MockVWS() as mock: + database = VuforiaDatabase() + mock.add_database(database=database) + vws_client = VWS( + server_access_key=database.server_access_key, + server_secret_key=database.server_secret_key, + ) + cloud_reco_client = CloudRecoService( + client_access_key=database.client_access_key, + client_secret_key=database.client_secret_key, + ) + + image = pathlib.Path("high_quality_image.jpg") + with image.open(mode="rb") as my_image_file: + target_id = vws_client.add_target( + name="example_image_name", + width=1, + image=my_image_file, + application_metadata=None, + active_flag=True, + ) + + vws_client.wait_for_target_processed(target_id=target_id) + matching_targets = cloud_reco_client.query(image=my_image_file) + + assert matching_targets[0].target_id == target_id + - image = pathlib.Path("high_quality_image.jpg") - with image.open(mode="rb") as my_image_file: - target_id = vws_client.add_target( - name="example_image_name", - width=1, - image=my_image_file, - application_metadata=None, - active_flag=True, - ) - - vws_client.wait_for_target_processed(target_id=target_id) - matching_targets = cloud_reco_client.query(image=my_image_file) - assert matching_targets[0].target_id == target_id + test_add_target() There are some differences between the mock and the real Vuforia. See https://vws-python-mock.readthedocs.io/en/latest/differences-to-vws.html for details.