.. _debugging:

Debugging
=========

It is recomended to specify ``django_any.WithTestDataSeed`` as metaclass
for your TestCase::

    from django_any import any_model, WithTestDataSeed

    class SiteTests(TestCase):
        __metaclass__ = WithTestDataSeed

        def test_something(self):
            ....

If you test sometimes fails, in error log, you could found used
random seed.::

    ======================================================================
    FAIL: test__something (mysite.SiteTests) With seed 1434556623


You could use this seed, to repeat and debug you tests, with exactly
the same random data::

    from django_any import any_model, WithTestDataSeed, with_seed, without_random_seed

    class SiteTests(TestCase):
        __metaclass__ = WithTestDataSeed

        @without_random_seed
        @with_seed(1434556623)
        def test_something(self):
            ....

``without_random_seed`` decorator disables test run with random seed, and
``with_seed`` runs test with selected seed.