From c1e94848174b1a21d99d7a0ce0aa98efbaf732fd959e76632b66a0724546d086 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 14 Sep 2021 06:25:19 +0000 Subject: [PATCH] - Switch to pytest-django from django-nose. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-django-seed?expand=0&rev=7 --- python-django-seed.changes | 5 +++++ python-django-seed.spec | 12 ++++++++---- settings.py | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 settings.py diff --git a/python-django-seed.changes b/python-django-seed.changes index c794f78..255c3c6 100644 --- a/python-django-seed.changes +++ b/python-django-seed.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Sep 14 06:22:59 UTC 2021 - Steve Kowalik + +- Switch to pytest-django from django-nose. + ------------------------------------------------------------------- Thu Feb 20 08:57:06 UTC 2020 - Tomáš Chvátal diff --git a/python-django-seed.spec b/python-django-seed.spec index 81eed54..550febe 100644 --- a/python-django-seed.spec +++ b/python-django-seed.spec @@ -1,7 +1,7 @@ # # spec file for package python-django-seed # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,7 +23,8 @@ Release: 0 Summary: Django project fake data seeder License: MIT URL: https://github.com/brobin/django-seed -Source: https://files.pythonhosted.org/packages/source/d/django-seed/django-seed-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/d/django-seed/django-seed-%{version}.tar.gz +Source1: settings.py BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -34,7 +35,8 @@ BuildArch: noarch BuildRequires: %{python_module Django >= 1.11} BuildRequires: %{python_module Faker >= 0.7.7} BuildRequires: %{python_module coverage} -BuildRequires: %{python_module django-nose} +BuildRequires: %{python_module pytest-django} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -44,6 +46,7 @@ A module to seed Django projects with fake data. %prep %setup -q -n django-seed-%{version} sed -i 's/fake-factory/Faker/' setup.py +cp %SOURCE1 django_seed %build %python_build @@ -53,7 +56,8 @@ sed -i 's/fake-factory/Faker/' setup.py %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec setup.py test +export DJANGO_SETTINGS_MODULE=django_seed.settings +%pytest %{buildroot}%{$python_sitelib}/django_seed/tests.py %files %{python_files} %license LICENSE diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..7f3bfba --- /dev/null +++ b/settings.py @@ -0,0 +1,14 @@ +from faker import Faker +fake = Faker() + +DATABASES={ + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': ':memory:', + } +} +INSTALLED_APPS=( + 'django_seed', +) +SECRET_KEY=fake.sha1() +