pdg.testing package

Submodules

pdg.testing.fake_shotgun_api3 module

A fake for the Shotgun API.

class pdg.testing.fake_shotgun_api3.Shotgun(*args, **kwargs)

Bases: object

A Fake Shotgun API object.

This Shotgun API object works for putting things in and getting them back out. It makes almost no assumptions on what should be in Shotgun already. It is meant to test the integration between the different Shotgun nodes, so that we can test entire pipelines of nodes. Don’t expect to get anything out of this API that you didn’t put in.

This uses the Borg pattern because all real Shotgun API objects with the same credentials share the same Shotgun server state. This also means that tests using this fake should not expect to pass in different credentials and expect to see a different state. Furthermore, since the shotgunrpc server uses multiple threads to handle requests, having shared state is necessary for a consistent view of the fake Shotgun state within a single graph. This relies on Python’s GIL for thread-safety.

http://code.activestate.com/recipes/66531-singleton-we-dont-need-no-stinkin-singleton-the-bo/

close()
connect()
create(entity_type, data, return_fields=None)

Create a new entity with fields described in data.

To support return_fields, these fields will be initialized with the string value “fake”.

Returns:
A dict of the newly created entity with type and id.
download_attachment(attachment, file_path)
find(entity_type, filters, fields=None, order=None, filter_operator=None, limit=0, retired_only=False, page=0, include_archived_projects=True, additional_filter_presets=None)

Find a shotgun entity.

All filter-related parameters are ignored, except for a single ‘is’ filter. Otherwise, it just returns all entities of entity_type up to limit. fields is also supported.

find_one(entity_type, filters, fields=None, order=None, filter_operator=None, retired_only=False, page=0, include_archived_projects=True, additional_filter_presets=None)
get_session_token()
info()
update(entity_type, entity_id, data)
upload(entity_type, entity_id, path, field_name=None, display_name=None, tag_list=None)

Module contents