forked from pool/python-factory_boy
Accepting request 942834 from home:bnavigator:branches:devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/942834 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-factory_boy?expand=0&rev=23
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Dec 27 18:24:13 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Add tests-skip-django-py36.patch -- no Django 4 for python36
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun May 16 13:01:17 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
Sun May 16 13:01:17 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
@@ -25,13 +25,15 @@ Summary: Python test fixtures
|
|||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/rbarrois/factory_boy
|
URL: https://github.com/rbarrois/factory_boy
|
||||||
Source: https://files.pythonhosted.org/packages/source/f/factory_boy/factory_boy-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/f/factory_boy/factory_boy-%{version}.tar.gz
|
||||||
BuildRequires: %{python_module Django}
|
# PATCH-FEATURE-OPENSUSE tests-skip-django-py36.patch -- don't test django on python36: no python36-Django 4, code@bnavigator.de
|
||||||
|
Patch0: tests-skip-django-py36.patch
|
||||||
BuildRequires: %{python_module Faker >= 0.7.0}
|
BuildRequires: %{python_module Faker >= 0.7.0}
|
||||||
BuildRequires: %{python_module Pillow}
|
BuildRequires: %{python_module Pillow}
|
||||||
BuildRequires: %{python_module setuptools >= 0.8}
|
BuildRequires: %{python_module setuptools >= 0.8}
|
||||||
BuildRequires: %{pythons}
|
BuildRequires: %{pythons}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
BuildRequires: %{python_module Django if (%python-base without python36-base)}
|
||||||
Requires: python-Faker >= 0.7.0
|
Requires: python-Faker >= 0.7.0
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
@@ -40,7 +42,7 @@ BuildArch: noarch
|
|||||||
A test fixtures replacement based on thoughtbot's factory_girl for Ruby.
|
A test fixtures replacement based on thoughtbot's factory_girl for Ruby.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n factory_boy-%{version}
|
%autosetup -p1 -n factory_boy-%{version}
|
||||||
# needs running mongo
|
# needs running mongo
|
||||||
rm tests/test_mongoengine.py
|
rm tests/test_mongoengine.py
|
||||||
sed -i -e '/test_mongoengine/d' tests/__init__.py
|
sed -i -e '/test_mongoengine/d' tests/__init__.py
|
||||||
|
92
tests-skip-django-py36.patch
Normal file
92
tests-skip-django-py36.patch
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
Index: factory_boy-3.2.0/tests/test_django.py
|
||||||
|
===================================================================
|
||||||
|
--- factory_boy-3.2.0.orig/tests/test_django.py
|
||||||
|
+++ factory_boy-3.2.0/tests/test_django.py
|
||||||
|
@@ -7,11 +7,14 @@ import os
|
||||||
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
-import django
|
||||||
|
-from django import test as django_test
|
||||||
|
-from django.conf import settings
|
||||||
|
-from django.db.models import signals
|
||||||
|
-from django.test import utils as django_test_utils
|
||||||
|
+try:
|
||||||
|
+ import django
|
||||||
|
+ from django import test as django_test
|
||||||
|
+ from django.conf import settings
|
||||||
|
+ from django.db.models import signals
|
||||||
|
+ from django.test import utils as django_test_utils
|
||||||
|
+except ImportError:
|
||||||
|
+ raise unittest.SkipTest("No Django installed")
|
||||||
|
|
||||||
|
import factory.django
|
||||||
|
|
||||||
|
Index: factory_boy-3.2.0/tests/test_using.py
|
||||||
|
===================================================================
|
||||||
|
--- factory_boy-3.2.0.orig/tests/test_using.py
|
||||||
|
+++ factory_boy-3.2.0/tests/test_using.py
|
||||||
|
@@ -11,6 +11,7 @@ import unittest
|
||||||
|
|
||||||
|
import factory
|
||||||
|
from factory import errors
|
||||||
|
+nodjango = not hasattr(factory, 'django')
|
||||||
|
|
||||||
|
from . import utils
|
||||||
|
|
||||||
|
@@ -141,6 +142,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_create_custom_base(self):
|
||||||
|
obj = factory.create(FakeModel, foo='bar', FACTORY_CLASS=factory.django.DjangoModelFactory)
|
||||||
|
self.assertEqual(obj.id, 2)
|
||||||
|
@@ -156,6 +158,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_create_batch_custom_base(self):
|
||||||
|
objs = factory.create_batch(
|
||||||
|
FakeModel,
|
||||||
|
@@ -196,6 +199,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_generate_create_custom_base(self):
|
||||||
|
obj = factory.generate(
|
||||||
|
FakeModel,
|
||||||
|
@@ -231,6 +235,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_generate_batch_create_custom_base(self):
|
||||||
|
objs = factory.generate_batch(
|
||||||
|
FakeModel,
|
||||||
|
@@ -267,6 +272,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_simple_generate_create_custom_base(self):
|
||||||
|
obj = factory.simple_generate(FakeModel, True, foo='bar', FACTORY_CLASS=factory.django.DjangoModelFactory)
|
||||||
|
self.assertEqual(obj.id, 2)
|
||||||
|
@@ -292,6 +298,7 @@ class SimpleBuildTestCase(unittest.TestC
|
||||||
|
self.assertEqual(obj.id, None)
|
||||||
|
self.assertEqual(obj.foo, 'bar')
|
||||||
|
|
||||||
|
+ @unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
def test_simple_generate_batch_create_custom_base(self):
|
||||||
|
objs = factory.simple_generate_batch(
|
||||||
|
FakeModel,
|
||||||
|
@@ -2046,6 +2053,7 @@ class BetterFakeModel:
|
||||||
|
self.id = None
|
||||||
|
|
||||||
|
|
||||||
|
+@unittest.skipIf(nodjango, "No Django installed")
|
||||||
|
class DjangoModelFactoryTestCase(unittest.TestCase):
|
||||||
|
def test_simple(self):
|
||||||
|
class FakeModelFactory(factory.django.DjangoModelFactory):
|
Reference in New Issue
Block a user