Skip to main content

mamba-django

PyPI pyversions

A Django test runner for mamba.

How to install

pip install mamba-django

How to use

Go to your Django test settings and add this line

TEST_RUNNER = 'mamba_django.MambaRunner'

and then execute the Django tests

./manage.py test --settings=project.settings.test --keepdb

or you can execute the tests passing it as parameter

./manage.py test --testrunner mamba_django.MambaRunner --settings=project.settings.test --keepdb

Also, you can pass all the mamba parameters to the Django test command.

For example:

./manage.py test --settings=project.settings.test --keepdb -f documentation -s 1

How to execute mamba tests with Django database transactions

from expects import (
    equal,
    expect
)

from mamba_django import (
    start_django_transactions,
    rollback_django_transactions
)

from myapp.models import Animal


with description("Mamba with Django") as self:

    with before.each:
        self.transactions = start_django_transactions()

    with context("Running atomic tests"):

        with it("creates an animal"):
            Animal.objects.create(name="lion", sound="roar")
            expect(Animal.objects.all().count()).to(equal(1))

        with it("creates another animal"):
            Animal.objects.create(name="lion", sound="roar")
            expect(Animal.objects.all().count()).to(equal(1))

    with after.each:
        rollback_django_transactions(self.transactions)

How to load Django fixtures

You can use the method load_fixtures to load Django fixtures.

from expects import (
    equal,
    expect
)

from mamba_django import (
    load_fixtures,
    start_django_transactions,
    rollback_django_transactions
)

from django.contrib.auth.models import Group


with description("Mamba with Django") as self:

    with before.each:
        self.transactions = start_django_transactions()
        load_fixtures(['group.json'])

    with context("Fixtures"):

        with it("can retrieve loaded fixtures"):
            expect(Group.objects.all().count()).to(equal(1))

    with after.each:
        rollback_django_transactions(self.transactions)

Metadata

Release files for mamba-django 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mamba-django 0.8.0
File Size Uploaded Provenance Actions
mamba-django-0.8.0.tar.gz 3.6 kB Without provenance Details for mamba-django-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mamba-django 0.8.0
File Interpreter ABI Platform Actions
mamba_django-0.8.0-py3-none-any.whl Python 3 none any Details for mamba_django-0.8.0-py3-none-any.whl

Total release size: 8.4 kB

Release files / mamba-django-0.8.0.tar.gz

Download URL mamba-django-0.8.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c601a729ea3036dd0930b6e731899ec2371ced127a2351353ec39ceaf260ead5
BLAKE2b-256 checksum
How to use checksums
fbafae83aa0bfc6d63a9f2984af2884b05ad61e3cd9010713d6b02105a833e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Release files / mamba_django-0.8.0-py3-none-any.whl

Download URL mamba_django-0.8.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
865e324c5b833a0a2d4dfbe644c7607444119525182c07f8060a77e14618026d
BLAKE2b-256 checksum
How to use checksums
2fae47246edcf52ccce7dd00ac33c1a2ac1b9781cf301181731df0c8bc93e67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Security for mamba-django 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page