GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing vws-python.github.io — Contributing to vws-python-mock - vws-python-mock Contributing to vws-python-mock¶Contributions to this repository must pass tests and linting. CI is the canonical source of truth. Install contribution dependencies¶Install Python dependencies in a virtual environment. $ pip install --editable . --group dev Spell checking requires $ brew install enchant and on Ubuntu with $ apt-get install -y enchant Install $ prek install Linting¶Run lint tools either by committing, or with: $ prek run --all-files --hook-stage pre-commit --verbose $ prek run --all-files --hook-stage pre-push --verbose $ prek run --all-files --hook-stage manual --verbose Running Tests¶Create an environment variable file for secrets: $ cp vuforia_secrets.env.example vuforia_secrets.env Some tests require Vuforia credentials.
To run these tests, add the Vuforia credentials to the file Then run $ pytest
Connecting to Vuforia¶To connect to Vuforia, Vuforia target databases must be created via the Vuforia Web UI. Then, secret keys must be set as environment variables. The test infrastructure allows those keys to be set in the file Do not use a target database that you are using for other purposes. This is because the test suite adds and deletes targets. To create a target database, first create a license key in the Vuforia License Manager. Then, add a database from the Vuforia Target Manager. To find the environment variables to set in the Two Cloud databases are necessary in order to run all the Cloud Target tests. One of those must be an inactive project. The script creates the inactive project automatically by deleting its license. VuMark tests require one VuMark database. Targets sometimes get stuck at the “Processing” stage meaning that they cannot be deleted. When this happens, create a new target database to use for testing. To create databases without using the browser, use $ export VWS_EMAIL_ADDRESS=... $ export VWS_PASSWORD=... $ export NEW_SECRETS_DIR=... # You may have to run this a few times, but it is idempotent. $ python admin/create_secrets_files.py # Each generated file gets its own active Cloud database credentials. For the complete archive and GitHub Actions setup procedure, see Continuous Integration. Skipping Some Tests¶The tests run against several backends: the real Vuforia, the in-memory mock, and the Flask applications of the mock served in the test process.
The last of these exercises the handlers which the Docker deployment runs, but not the split between its containers.
The tests in --skip-backend=real Skip tests against the real Vuforia
--skip-backend=mock Skip tests against the in-memory mock Vuforia
--skip-backend=flask_in_process
Skip tests against the Flask applications served
in the test process
--skip-marker=requires_docker_build
Skip tests which build and run the Docker images
Give an option once per backend or marker to skip. Shared database credentials¶The shared API client fixtures, raw query helpers and recognition-report helpers accept Tests which read a database name use Shared backend setup¶An adapter supplies the service URLs through The Adapters declare supported behavior through Installed contract tests¶The Container deployment tests¶The deployment tests build and run three separate services through the Docker Python SDK. They use the Docker engine selected by the current Docker configuration by default: $ uv run --group=dev pytest tests/mock_vws/test_docker.py To run the same tests with Apple’s container runtime, complete the runtime installation steps in Creating containers with Apple container, then install Socktainer 1.5.2 or later. It provides the Docker-compatible API used by the Python deployment tests: $ brew install socktainer $ socktainer --no-auto-start --no-docker-context Keep Socktainer running in that terminal. In another terminal, select its socket for the test command: $ DOCKER_HOST="unix://$HOME/.socktainer/container.sock" \ uv run --group=dev pytest tests/mock_vws/test_docker.py The deployment tests automatically negotiate the API version. Both configurations exercise native health checks, published HTTP ports, application behavior and restarts. Running the mock directly with Apple’s CLI uses the same images and is documented in Creating containers with Apple container. Target-manager and VWQ use automatically published ports. VWS keeps an explicit loopback binding so its report download URLs are known before startup. Test containers, image tags and networks are removed after the run, including when setup fails. Hosted CI continues to use Docker. Apple deployment validation runs on a local Mac. Verifying signed Model Target requests¶Creating an advanced Model Target dataset with a state-based configuration or a standard dataset with inline CAD data is a “signed” request: the real Vuforia signs the trained dataset, and each signing consumes the account’s Model Target training allowance.
The allowance is small (roughly 20 signings), it is shared by every CI job and every concurrent run, and it cannot be raised or reset.
Verifying signed requests on every run exhausted the allowance within hours and then made every CI run fail with The signed test cases therefore run against the mock backends on every run, but are skipped against the real Vuforia by default. To verify them against the real Vuforia, for example after the allowance has recovered, opt in with: --verify-model-target-signing
Run signed Model Target dataset tests against
the real Vuforia
The equivalent unsigned requests (a standard dataset, or an advanced dataset without a state-based configuration) are far cheaper and are verified against the real Vuforia on every run.
With enough traffic even unsigned dataset creation can be rejected with Retrying transient real Model Target failures¶The load balancer in front of the real Model Target Web API sometimes answers a perfectly good request with a gateway error, or drops the connection. That is nothing to do with the contract under test, and a rerun of the same job passes, so a small number of retries is applied to requests which are safe to repeat. The policy is in The mock backends are unaffected, so tests which configure a mock to answer with a 5xx still get that response immediately. This is separate from the repository-wide Documentation¶Documentation is built on Read the Docs. Run the following commands to build and view documentation locally: $ uv run --group=dev sphinx-build -M html docs/source docs/build -W $ python -c 'import os, webbrowser; webbrowser.open("file://" + os.path.abspath("docs/build/html/index.html"))' Continuous Integration¶Learnings about VWS¶Vuforia Web Services, at the time of writing, does not behave exactly as documented. The following list includes details of differences between VWS and expected or documented behavior. When attempting to delete a target immediately after creating it, a
The The database summary from The database summary from The documentation page Vuforia Query Web API states that the The documentation page Vuforia Query Web API states that The documentation page Vuforia Query Web API states that 10 is the maximum allowed value of A response to an invalid query may have an After deleting a target, for up to approximately 30 seconds, matching it with a query returns a 500 response. A target with the name The documentation page Vuforia Query Web API states that “The API accepts requests with unknown data fields, and ignore the unknown fields.”. This is not the case. The documentation page Vuforia Query Web API states “Maximum image size: 2.1 MPixel. 512 KiB for JPEG, 2MiB for PNG”. However, JPEG images up to 2MiB are accepted. There is no documented limit on the number of pixels in an image, but The The documentation for the target summary report says “Note: tracking_rating and Release Process¶See Release Process. Release notes¶Write user-facing changes as Markdown in |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |