{"id":20905052,"url":"https://github.com/kaste/pytest-beds","last_synced_at":"2025-05-13T05:30:59.971Z","repository":{"id":16488960,"uuid":"19241557","full_name":"kaste/pytest-beds","owner":"kaste","description":"Fixtures for testing Google Appengine (GAE) apps","archived":false,"fork":false,"pushed_at":"2016-06-07T19:55:08.000Z","size":13,"stargazers_count":10,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T12:44:40.924Z","etag":null,"topics":["app-engine","google-appengine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaste.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-28T14:29:43.000Z","updated_at":"2023-05-15T03:00:33.000Z","dependencies_parsed_at":"2022-09-13T22:21:03.784Z","dependency_job_id":null,"html_url":"https://github.com/kaste/pytest-beds","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaste%2Fpytest-beds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaste%2Fpytest-beds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaste%2Fpytest-beds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaste%2Fpytest-beds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaste","download_url":"https://codeload.github.com/kaste/pytest-beds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253882818,"owners_count":21978549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-engine","google-appengine"],"created_at":"2024-11-18T13:21:28.804Z","updated_at":"2025-05-13T05:30:59.660Z","avatar_url":"https://github.com/kaste.png","language":"Python","readme":"Convenience plugin on top of the testbed the Google Appengine (GAE) SDK already provides.\n\n.. image:: https://travis-ci.org/kaste/pytest-beds.svg?branch=master\n    :target: https://travis-ci.org/kaste/pytest-beds\n\nInstall\n=======\n\n``pip install pytest-beds``\n\nAfter that the plugin is enabled by default. You can use specific fixtures (see below) to activate the Testbed and stub specific services.\n\n\nOptions\n=======\n\n``--no-gae``\n    Disable the plugin, esp. do not change the python paths and try to import dev_appserver.\n\n``--sdk-path PATH``\n    The plugin assumes it can just ``import dev_apserver``. If that fails it looks up the SDK path in the environment variable ``GAE``. Otherwise, you can specify the path to the SDK by using the ``--sdk-path PATH`` option.\n\n``--project-root PATH``\n    Secondly, the plugin assume that your current path is the projects root folder, t.i. the dirctory which holds the app.yaml. You can specify a different path using ``--project-root PATH``.\n\n``--noisy-tasklets``\n    By default the plugin shortens the tracebacks when using ndb tasklets, so they don't include the eventloop's internal noise.\n    Use this switch to make ndb noisy again.\n\n\nFixtures\n========\n\nThe plugin provides fixtures to stub the different services. Usage is therefore simple and straightforward::\n\n    # Say, if you create a Foo you hit the database and put some work on queue\n    def test_foo(ndb, taskqueue):\n        foo = Foo.create()\n\n        assert Foo.query().fetch() == [foo]\n\nList of builtin fixtures::\n\n    bed\n    mailer\n    channel\n    urlfetch\n    memcache\n    taskqueue\n    blobstore\n    ndb\n    users\n\n\nUsers\n-----\n\nThere are two fixtures ``anonymous`` and ``login`` to handle the users-stub.\n\n``anonymous``\n    Prepares the user stub so that ``users.get_current_user()`` will return None\n\n``login``\n    Prepares the user stub and returns a function to login actual users::\n\n        def test_login(login):\n            # at this point users.get_current_user() will return None\n\n            login(id=1, email='foo@gmail.com')\n            # now users.get_current_user() will return a user\n\n            login.logout()\n            # now users.get_current_user() will return None again\n\n\nDeferreds\n---------\n\nThe ``deferreds`` fixture inits the taskqueue stub, but returns a useful object, so you can actually run the deferred functions::\n\n    def test_work(deferreds):\n        deferred.defer(work, 'to be done')\n\n        deferreds.consume()\n\n        assert 'work has been done'\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaste%2Fpytest-beds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaste%2Fpytest-beds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaste%2Fpytest-beds/lists"}