Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire up cls.setUpTestData for class level fixtures #972

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 30, 2021

  1. Wire up cls.setUpTestData for class level fixtures

    Reimplement the Django TestCase's setUpTestData. Since we are
    already calling the setUpClass machinery from TestCase, it's a
    simple step to arrange for PytestDjangoTestCase to call the real
    test class's setUpTestData classmethod.
    
    This allows us to defer to the existing lifecycle hook machinery,
    and also use the Django 3.2 implementation for TestData which
    uses a descriptor to handle re-loading test instances between tests.
    (It does this by memoizing the pre-test instances, so this avoids
    us having to add a DB transaction or refresh_from_db() to reset the
    testData.)
    paultiplady committed Nov 30, 2021
    Configuration menu
    Copy the full SHA
    d8e3b50 View commit details
    Browse the repository at this point in the history