[arch-commits] Commit in python-django-fake-model/repos (3 files)

Felix Yan felixonmars at gemini.archlinux.org
Wed Dec 1 14:54:51 UTC 2021


    Date: Wednesday, December 1, 2021 @ 14:54:51
  Author: felixonmars
Revision: 1059521

archrelease: copy trunk to community-staging-any

Added:
  python-django-fake-model/repos/community-staging-any/
  python-django-fake-model/repos/community-staging-any/PKGBUILD
    (from rev 1059519, python-django-fake-model/trunk/PKGBUILD)
  python-django-fake-model/repos/community-staging-any/django2.diff
    (from rev 1059519, python-django-fake-model/trunk/django2.diff)

--------------+
 PKGBUILD     |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 django2.diff |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)

Copied: python-django-fake-model/repos/community-staging-any/PKGBUILD (from rev 1059519, python-django-fake-model/trunk/PKGBUILD)
===================================================================
--- community-staging-any/PKGBUILD	                        (rev 0)
+++ community-staging-any/PKGBUILD	2021-12-01 14:54:51 UTC (rev 1059521)
@@ -0,0 +1,47 @@
+# Maintainer: Chih-Hsuan Yen <yan12125 at archlinux.org>
+
+_pkgname=django-fake-model
+pkgname=python-$_pkgname
+pkgver=0.1.4
+pkgrel=4
+pkgdesc='Simple library for creating fake Django models in the unit tests'
+arch=(any)
+url='https://github.com/erm0l0v/django-fake-model'
+license=(BSD)
+makedepends=(python-setuptools)
+depends=(python-django)
+# Not using PyPI source tarball as it does not include tests
+source=("https://github.com/erm0l0v/django-fake-model/archive/$pkgver/$pkgname-$pkgver.tar.gz"
+        django2.diff)
+sha256sums=('cce30e32dc73a0b6280511cb92079755308a4b79fbfebda48fc55c48230b1d60'
+            'ffc0baaacf4a0b507ef99fc0975166cb2a36dde061a2be72e91959157183889d')
+
+prepare() {
+  cd $_pkgname-$pkgver
+  # Fix compatibility with newer Django
+  # 1. on_delete is required for ForeignKey since 2.0 [1]
+  # 2. Failure in toggling off foreign_keys are reported since 2.2 [2].
+  #    The underlying cause is that django.test.TestCase puts the whole test
+  #    in a transaction, and toggling foreign_keys in a transaction is not
+  #    supported in SQLite. Use django.test.TransactionTestCase to work
+  #    around it.
+  # [1] https://github.com/django/django/commit/ddd3268975dca9094d94ab1df56dae0a24a58865
+  # [2] https://github.com/django/django/commit/315357ad25a6590e7f4564ec2e56a22132b09001
+  patch -Np1 -i ../django2.diff
+}
+
+build() {
+  cd $_pkgname-$pkgver
+  python setup.py build
+}
+
+check() {
+  cd $_pkgname-$pkgver
+  python runtests.py tests
+}
+
+package() {
+  cd $_pkgname-$pkgver
+  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
+}

Copied: python-django-fake-model/repos/community-staging-any/django2.diff (from rev 1059519, python-django-fake-model/trunk/django2.diff)
===================================================================
--- community-staging-any/django2.diff	                        (rev 0)
+++ community-staging-any/django2.diff	2021-12-01 14:54:51 UTC (rev 1059521)
@@ -0,0 +1,46 @@
+diff --git a/tests/test_class_extension.py b/tests/test_class_extension.py
+index 066283a..09662d2 100644
+--- a/tests/test_class_extension.py
++++ b/tests/test_class_extension.py
+@@ -1,10 +1,10 @@
+ from __future__ import unicode_literals
+-from django.test import TestCase
++from django.test import TransactionTestCase
+ from tests.fake_models import MyFakeModel
+ 
+ 
+ @MyFakeModel.fake_me
+-class MyFakeModelTests(TestCase):
++class MyFakeModelTests(TransactionTestCase):
+ 
+     def test_create_model(self):
+         MyFakeModel.objects.create(name='123')
+diff --git a/tests/test_func_decorator.py b/tests/test_func_decorator.py
+index 4394e7c..37a05fa 100644
+--- a/tests/test_func_decorator.py
++++ b/tests/test_func_decorator.py
+@@ -1,9 +1,9 @@
+ from __future__ import unicode_literals
+-from django.test import TestCase
++from django.test import TransactionTestCase
+ from tests.fake_models import MyFakeModel
+ 
+ 
+-class MyFakeModelTests(TestCase):
++class MyFakeModelTests(TransactionTestCase):
+ 
+     @MyFakeModel.fake_me
+     def test_create_model(self):
+diff --git a/tests/test_related_model.py b/tests/test_related_model.py
+index 4184a68..5be0ad6 100644
+--- a/tests/test_related_model.py
++++ b/tests/test_related_model.py
+@@ -11,7 +11,7 @@ class RelatedModel(f.FakeModel):
+ 
+ class MyModel(f.FakeModel):
+     text = models.CharField(max_length=400)
+-    related_model = models.ForeignKey(RelatedModel)
++    related_model = models.ForeignKey(RelatedModel, on_delete=models.CASCADE)
+ 
+ 
+ @MyModel.fake_me



More information about the arch-commits mailing list