Date: Friday, April 17, 2020 @ 03:56:28 Author: yan12125 Revision: 615401
archrelease: copy trunk to community-any Added: python-django-fake-model/repos/community-any/ python-django-fake-model/repos/community-any/PKGBUILD (from rev 615400, python-django-fake-model/trunk/PKGBUILD) python-django-fake-model/repos/community-any/django2.diff (from rev 615400, python-django-fake-model/trunk/django2.diff) --------------+ PKGBUILD | 47 +++++++++++++++++++++++++++++++++++++++++++++++ django2.diff | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) Copied: python-django-fake-model/repos/community-any/PKGBUILD (from rev 615400, python-django-fake-model/trunk/PKGBUILD) =================================================================== --- community-any/PKGBUILD (rev 0) +++ community-any/PKGBUILD 2020-04-17 03:56:28 UTC (rev 615401) @@ -0,0 +1,47 @@ +# Maintainer: Chih-Hsuan Yen <yan12...@archlinux.org> + +_pkgname=django-fake-model +pkgname=python-$_pkgname +pkgver=0.1.4 +pkgrel=1 +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-any/django2.diff (from rev 615400, python-django-fake-model/trunk/django2.diff) =================================================================== --- community-any/django2.diff (rev 0) +++ community-any/django2.diff 2020-04-17 03:56:28 UTC (rev 615401) @@ -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