Sync from SUSE:SLFO:Main python-factory_boy revision 047fbeb4badd8ec481fba7f2cd6aaf30

This commit is contained in:
Adrian Schröter 2024-05-03 20:37:37 +02:00
commit f4f4fe4935
5 changed files with 502 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
factory_boy-3.2.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

312
python-factory_boy.changes Normal file
View File

@ -0,0 +1,312 @@
-------------------------------------------------------------------
Fri Apr 21 12:24:55 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Wed Feb 1 20:48:11 UTC 2023 - Dirk Müller <dmueller@suse.com>
- skip testing with Django on SLE15
-------------------------------------------------------------------
Sat Jan 15 16:04:33 UTC 2022 - Dirk Müller <dmueller@suse.com>
- update to 3.2.1:
- Add support for Django 3.2
- Do not override signals receivers registered in a :meth:`~factory.django.mute_signals` context.
-------------------------------------------------------------------
Tue Dec 28 22:54:39 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add missing BR typing_extensions
-------------------------------------------------------------------
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>
- Update to v3.2.0
* Add support for Django 3.1
* Add support for Python 3.9
* Drop support for Django 1.11. This version is not maintained
anymore.
* Drop support for Python 3.5. This version is not maintained
anymore.
Deprecated:
* factory.use_strategy(). Use factory.FactoryOptions.strategy
instead. The purpose of use_strategy() duplicates the factory
option. Follow PEP 20: There should be one and preferably only
one obvious way to do it.
* use_strategy() will be removed in the next major version.
Bug fix:
* Calls to factory.Faker and factory.django.FileField within a
Trait or Maybe no longer lead to a KeyError crash.
- Remove python2 build conditional: Not supported upstream
-------------------------------------------------------------------
Mon Oct 5 06:11:53 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Use PyPI tarball and revise test runner to python -m unittest
- Update to v3.1.0
* Allow all types of declarations in :class:`factory.Faker` calls
enables references to other faker-defined attributes.
- from v3.0.1
* Fix `import factory; factory.django.DjangoModelFactory` and
similar calls.
- from v3.0.0
* Removed alias
+ `from factory import DjangoModelFactory` to
`from factory.django import DjangoModelFactory`
+ `from factory import MogoFactory` to
`from factory.mogo import MogoFactory`
+ `from factory.fuzzy import get_random_state` to
`from factory.random import get_random_state`
+ `from factory.fuzzy import set_random_state` to
`from factory.random import set_random_state`
+ `from factory.fuzzy import reseed_random` to
`from factory.random import reseed_random`
* Drop support for Python 2 and 3.4
* Drop support for Django 2.0 and 2.1
* Remove deprecated `force_flush` from `SQLAlchemyModelFactory`
Use `sqlalchemy_session_persistence = "flush"` instead
* Drop deprecated `attributes()` from `factory.Factory`; use
`make_factory(dict, FactoryClass._meta.pre_declarations)`
* Drop deprecated `declarations()` from `factory.Factory`; use
`FactoryClass._meta.pre_declarations` instead
* Drop `factory.compat` module
* Add support for Python 3.8
* Add support for Django 2.2 and 3.0
* Report misconfiguration when `Factory` is used
as the `Factory.model` for another `Factory`
* Allow configuring the color palette of `factory.django.ImageField`
* `get_random_state()` now represents the state of Faker and
`factory_boy` fuzzy attributes
* Add SQLAlchemy ``get_or_create`` support
* Display a developer-friendly error message when providing a model
instead of a factory in a `factory.declarations.SubFactory` class
* Fix issue with SubFactory not preserving signal muting behaviour
of the used factory
* Fix issue with overriding params in a Trait
* Limit ``get_or_create`` behavior to fields specified in
`django_get_or_create`
* Re-raise `~django.db.IntegrityError` when `django_get_or_create`
with multiple fields fails to lookup model using user provided
keyword arguments
* TypeError masked by __repr__ AttributeError when initializing
`Maybe` with inconsistent phases
-------------------------------------------------------------------
Mon Mar 16 10:31:31 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix build without python2
-------------------------------------------------------------------
Mon Nov 18 00:57:55 UTC 2019 - Steve Kowalik <steven.kowalik@suse.com>
- BuildRequires on %{pythons} as setuptools no longer drags it in.
-------------------------------------------------------------------
Fri Jun 7 11:54:06 UTC 2019 - Marketa Calabkova <mcalabkova@suse.com>
- Update to version 2.12.0
* NOW support for Python 3.7 and Django 2.1
* various small bugfixes
- Removed upstreamed patches:
* python37.patch
* django-2.2.patch
-------------------------------------------------------------------
Wed Apr 17 10:14:58 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to support django 2.2:
* django-2.2.patch
-------------------------------------------------------------------
Thu Oct 18 09:40:04 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 2.11.1:
* Support for Django 2.1
* Support for python 3.7
* Various small bugfixes
- Add patch python37.patch
-------------------------------------------------------------------
Fri Oct 6 09:52:31 UTC 2017 - tchvatal@suse.com
- Update to version 2.9.2:
* read the upstream ChangeLog for in detail list as there are
too many changes
- Do not generate docu in the spec and make sure tests are run
- Switch to python singlespec
-------------------------------------------------------------------
Mon May 4 16:15:37 UTC 2015 - benoit.monin@gmx.fr
- update to version 2.5.2:
* Add support for Django 1.7/1.8
* Add support for mongoengine>=0.9.0 / pymongo>=2.1
- additional changes from version 2.5.1:
* Respect custom managers in DjangoModelFactory (see issue #192)
* Allow passing declarations (e.g Sequence) as parameters to
FileField and ImageField.
- additional changes from version 2.5.0:
* Add support for getting/setting factory.fuzzys random state
(see issue #175, issue #185).
* Support lazy evaluation of iterables in
factory.fuzzy.FuzzyChoice (see issue #184).
* Support non-default databases at the factory level (see issue
#171)
* Make factory.django.FileField and factory.django.ImageField
non-post_generation, i.e normal fields also available in save()
(see issue #141).
* Avoid issues when using factory.django.mute_signals() on a base
factory class (see issue #183).
* Fix limitations of factory.StubFactory, that can now use
factory.SubFactory and co (see issue #131).
* Remove deprecated features from 2.4.0 (2014-06-21)
* Remove the auto-magical sequence setup (based on the latest
primary key value in the database) for Django and SQLAlchemy;
this relates to issues issue #170, issue #153, issue #111,
issue #103, issue #92, issue #78.
* Fix overriding deeply inherited attributes (set in one factory,
overridden in a subclass, used in a sub-sub-class).
- additional changes from version 2.4.0:
* Add support for factory.fuzzy.FuzzyInteger.step, thanks to
ilya-pirogov (issue #120)
* Add mute_signals() decorator to temporarily disable some
signals, thanks to ilya-pirogov (issue #122)
* Add FuzzyFloat (issue #124)
* Declare target model and other non-declaration fields in a
class Meta section.
* Use of FACTORY_FOR and other FACTORY class-level attributes is
deprecated and will be removed in 2.5.
- additional changes from version 2.3.1:
* Fix badly written assert containing state-changing code,
spotted by chsigi (issue #126)
* Dont crash when handling objects whose __repr__ is
non-pure-ascii bytes on Py2, discovered by mbertheau (issue
#123) and strycore (issue #127)
- additional changes from version 2.3.0:
* Add FuzzyText, thanks to jdufresne (issue #97)
* Add FuzzyDecimal, thanks to thedrow (issue #94)
* Add support for EmbeddedDocument, thanks to imiric (issue #100)
- additional changes from version 2.2.1:
* Fixed sequence counter for DjangoModelFactory when a factory
inherits from another factory relating to an abstract model.
- additional changes from version 2.2.0:
* Removed duplicated SQLAlchemyModelFactory lurking in factory
(issue #83)
* Properly handle sequences within object inheritance chains. If
FactoryA inherits from FactoryB, and their associated classes
share the same link, sequence counters will be shared (issue
#93)
* Properly handle nested SubFactory overrides
* The DjangoModelFactory now supports the FACTORY_FOR =
'myapp.MyModel' syntax, making it easier to shove all factories
in a single module (issue #66).
* Add factory.debug() helper for easier backtrace analysis
* Adding factory support for mongoengine with MongoEngineFactory.
- additional changes from version 2.1.2:
* The ABSTRACT_FACTORY keyword is now optional, and automatically
set to True if neither the Factory subclass nor its parent
declare the FACTORY_FOR attribute (issue #74)
- additional changes from version 2.1.1:
* Properly retrieve the color keyword argument passed to
ImageField
- additional changes from version 2.1.0:
* Add FuzzyDate thanks to saulshanabrook
* Add FuzzyDateTime and FuzzyNaiveDateTime.
* Add a factory_parent attribute to the LazyStub passed to
LazyAttribute, in order to access fields defined in wrapping
factories.
* Move DjangoModelFactory and MogoFactory to their own modules
(factory.django and factory.mogo)
* Add the reset_sequence() classmethod to Factory to ease
resetting the sequence counter for a given factory.
* Add debug messages to factory logger.
* Add a reset() method to Iterator (issue #63)
* Add support for the SQLAlchemy ORM through
SQLAlchemyModelFactory (issue #64, thanks to Romain Commandé)
* Add factory.django.FileField and factory.django.ImageField
hooks for related Django model fields (issue #52)
* Properly handle non-integer pks in DjangoModelFactory (issue
#57).
* Disable RelatedFactory generation when a specific value was
passed (issue #62, thanks to Gabe Koscky)
* Rename RelatedFactorys name argument to factory_related_name
(See issue #58)
- additional changes from version 2.0.2:
* When FACTORY_DJANGO_GET_OR_CREATE is empty, use
Model.objects.create() instead of Model.objects.get_or_create.
- additional changes from version 2.0.1:
* Dont push defaults to get_or_create when
FACTORY_DJANGO_GET_OR_CREATE is not set.
- additional changes from version 2.0.0:
* Allow overriding the base factory class for make_factory() and
friends.
* Add support for Python3 (Thanks to kmike and nkryptic)
* The default type for Sequence is now int
* Fields listed in FACTORY_HIDDEN_ARGS wont be passed to the
associated class constructor
* Add support for get_or_create in DjangoModelFactory, through
FACTORY_DJANGO_GET_OR_CREATE.
* Add support for fuzzy attribute definitions.
* The Sequence counter can be overridden when calling a
generating function
* Add Dict and List declarations (Closes issue #18).
* Remove associated class discovery
* Remove InfiniteIterator and infinite_iterator()
* Remove CircularSubFactory
* Remove extract_prefix kwarg to post-generation hooks.
* Stop defaulting to Djangos Foo.objects.create() when
“creating” instances
* Remove STRATEGY_*
* Remove set_building_function() / set_creation_function()
- additional changes from version 1.3.0:
* Rewrite the whole documentation
* Provide a dedicated MogoFactory subclass of Factory
* Better creation/building customization hooks at
factory.Factory._build() and factory.Factory.create()
* Add support for passing non-kwarg parameters to a Factory
wrapped class through FACTORY_ARG_PARAMETERS.
* Keep the FACTORY_FOR attribute in Factory classes
* Allow SubFactory to solve circular dependencies between
factories
* Enhance SelfAttribute to handle “container” attribute fetching
* Add a getter to Iterator declarations
* A Iterator may be prevented from cycling by setting its cycle
argument to False
* Allow overriding default arguments in a
PostGenerationMethodCall when generating an instance of the
factory
* An object created by a DjangoModelFactory will be saved again
after PostGeneration hooks execution
* InfiniteIterator is deprecated in favor of Iterator
* CircularSubFactory is deprecated in favor of SubFactory
* The extract_prefix argument to post_generation() is now
deprecated
* Usage of set_creation_function() and set_building_function()
are now deprecated
* Implicit associated class discovery is no longer supported, you
must set the FACTORY_FOR attribute on all Factory subclasses
- add python-mock as BuildRequires for the tests
- add python-setuptools as BuildRequires: needed by setup.py
- build the documentation with the build_sphinx command
- pass -q to the test to avoid spamming the build log
- rename README to README.rst to follow upstream
-------------------------------------------------------------------
Fri Nov 23 11:06:19 UTC 2012 - saschpe@suse.de
- Update to version 1.2.0:
+ Upstream provides no changelog
- Build HTML documentation
-------------------------------------------------------------------
Mon Jun 11 13:10:36 UTC 2012 - saschpe@suse.de
- Initial version

72
python-factory_boy.spec Normal file
View File

@ -0,0 +1,72 @@
#
# spec file for package python-factory_boy
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-factory_boy
Version: 3.2.1
Release: 0
Summary: Python test fixtures
License: MIT
URL: https://github.com/rbarrois/factory_boy
Source: https://files.pythonhosted.org/packages/source/f/factory_boy/factory_boy-%{version}.tar.gz
# 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 Pillow}
BuildRequires: %{python_module setuptools >= 0.8}
BuildRequires: %{python_module typing_extensions}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if 0%{suse_version} >= 1550
BuildRequires: %{python_module Django}
%endif
Requires: python-Faker >= 0.7.0
BuildArch: noarch
%python_subpackages
%description
A test fixtures replacement based on thoughtbot's factory_girl for Ruby.
%prep
%autosetup -p1 -n factory_boy-%{version}
# needs running mongo
rm tests/test_mongoengine.py
sed -i -e '/test_mongoengine/d' tests/__init__.py
# sqlalchemy hickups a lot
rm tests/test_alchemy.py
sed -i -e '/test_alchemy/d' tests/__init__.py
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pyunittest -v
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/factory
%{python_sitelib}/factory_boy-%{version}*-info
%changelog

View 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):