title: Pytest-django: set user permissions
body: <p>I work on a library for Django using pytest 3.0.6 and pytest-django 3.1.2. I have this very simple test failing, and I don't understand what happen:</p>
  
  <pre><code># test_mytest.py
  import pytest
  from django.contrib.auth.models import Permission
  from django.contrib.contenttypes.models import ContentType
  
  
  @pytest.mark.django_db
  def test_user_has_perm(django_user_model):
      # Create a new user
      john_doe = django_user_model.objects.create_user('johndoe', email='jd@example.com', password='123456')
  
      # Get or create the permission to set on user
      user_ct = ContentType.objects.get(app_label='auth', model='user')
      p, _ = Permission.objects.get_or_create(content_type=user_ct, codename='delete_user', name="Can delete user")
  
      # User don't have the permission
      assert john_doe.has_perm(p) is False
  
      # Set permission to user
      john_doe.user_permissions.add(p)
      assert john_doe.has_perm(p) is True  # ---&gt; FAIL
  </code></pre>
  
  <p>Just in case, the result of the test is:</p>
  
  <pre><code>$ pytest
  ============================= test session starts =============================
  platform win32 -- Python 3.5.3, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
  Django settings: testsite.settings (from ini file)
  rootdir: D:\Dev\foss\django-modern-rpc, inifile: tox.ini
  plugins: pythonpath-0.7.1, django-3.1.2, cov-2.4.0
  collected 1 items
  
  modernrpc\tests\test_test_test.py F
  
  ================================== FAILURES ===================================
  _____________________________ test_user_has_perm ______________________________
  
  django_user_model = &lt;class 'django.contrib.auth.models.User'&gt;
  
      @pytest.mark.django_db
      def test_user_has_perm(django_user_model):
          # Create a new user
          john_doe = django_user_model.objects.create_user('johndoe', email='jd@example.com', password='123456')
  
          # Get or create the permission to set on user
          user_ct = ContentType.objects.get(app_label='auth', model='user')
          p, _ = Permission.objects.get_or_create(content_type=user_ct, codename='delete_user', name="Can delete user")
  
          # User don't have the permission
          assert john_doe.has_perm(p) is False
  
          # Set permission to user
          john_doe.user_permissions.add(p)
  &gt;       assert john_doe.has_perm(p) is True  # ---&gt; FAIL
  E       assert False is True
  E        +  where False = &lt;bound method PermissionsMixin.has_perm of &lt;User: johndoe&gt;&gt;(&lt;Permission: auth | user | Can delete user&gt;)
  E        +    where &lt;bound method PermissionsMixin.has_perm of &lt;User: johndoe&gt;&gt; = &lt;User: johndoe&gt;.has_perm
  
  modernrpc\tests\test_test_test.py:20: AssertionError
  ========================== 1 failed in 0.32 seconds ===========================
  </code></pre>
  
  <p>The config block, from tox.ini:</p>
  
  <pre><code>[pytest]
  DJANGO_SETTINGS_MODULE = testsite.settings
  norecursedirs = .git __pycache__ build dist venv* .tox .vscode .cache *.egg-info
  python_paths = modernrpc/tests
  testpaths = modernrpc/tests
  python_files = test_*.py dummy_*.py
  </code></pre>
  
  <p>And the DB configuration, from test settings:</p>
  
  <pre><code>BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'modern_rpc.sqlite3'),
      },
  }
  </code></pre>
  
  <p>What am I doing wrong ?</p>