Python 3.9 to 3.14. BSD-3-Clause.

A Flow Production Tracking mock that answers as a live site.

sg-mockgun replaces shotgun_api3.lib.mockgun with an in-memory mock that answers as a live site answers over api3.

Install

Requires Python 3.9 and shotgun-api3 3.10.5.

pip install sg-mockgun

Switch from upstream mockgun

# from shotgun_api3.lib import mockgun
import sg_mockgun as mockgun

Differences from upstream

Quick start

The bundled schema is a Flow PT 8.91 site's: 95 entity types, 1471 fields.

from sg_mockgun import Shotgun, schemas

Shotgun.set_schema_paths(*schemas.paths())
sg = Shotgun("https://mock.example.com", script_name="x", api_key="y")
sg.create("Project", {"name": "Demo"})

In pytest

def test_publish(sg):
    sg.load("tests/seed.json")
    sg.create("Version", {"code": "v001", "entity": {"type": "Shot", "id": 1001}})

Testing with pytest

How behaviour is measured

  1. A probe asks a live Flow PT 8.91 site one question over api3.
  2. The answer is recorded in docs/api3/, with ids and names replaced by placeholders.
  3. The mock code and its test cite the answer: # api3 030.
  4. REST rules come from the sg-groundtruth corpus, cited as # finding NNN.
  • Upstream mockgun's test suite passes on sg-mockgun.
  • tk-core's test suite passes on sg-mockgun, with the event log off and on.
  • CI runs on Python 3.9 to 3.14, on Linux, macOS and Windows.
  • Per-call results are in the coverage table.