diff --git a/.python-django-nose.metadata b/.python-django-nose.metadata new file mode 100644 index 0000000..81e3d1a --- /dev/null +++ b/.python-django-nose.metadata @@ -0,0 +1 @@ +0db5c276c8e49a7203f9569d25595433a3fb315f SOURCES/django-nose-1.4.7.tar.gz diff --git a/SOURCES/10568067acde9a5bcb83be609de6bdeb3c07ae01.patch b/SOURCES/10568067acde9a5bcb83be609de6bdeb3c07ae01.patch new file mode 100644 index 0000000..1eb2365 --- /dev/null +++ b/SOURCES/10568067acde9a5bcb83be609de6bdeb3c07ae01.patch @@ -0,0 +1,59 @@ +From 10568067acde9a5bcb83be609de6bdeb3c07ae01 Mon Sep 17 00:00:00 2001 +From: st4lk +Date: Mon, 2 Mar 2015 14:04:24 +0300 +Subject: [PATCH] set runner by option + +--- + django_nose/runner.py | 6 +++++- + runtests.sh | 1 + + testapp/custom_runner.py | 5 +++++ + 3 files changed, 11 insertions(+), 1 deletion(-) + create mode 100644 testapp/custom_runner.py + +diff --git a/django_nose/runner.py b/django_nose/runner.py +index bd3c767..b99d7fb 100644 +--- a/django_nose/runner.py ++++ b/django_nose/runner.py +@@ -156,6 +156,10 @@ class BasicNoseRunner(DiscoverRunner): + # Replace the builtin command options with the merged django/nose options: + options = _get_options() + ++ # Not add following options to nosetests ++ django_opts = ['--noinput', '--liveserver', '-p', '--pattern', ++ '--testrunner'] ++ + def run_suite(self, nose_argv): + result_plugin = ResultPlugin() + plugins_to_add = [DjangoSetUpPlugin(self), +@@ -208,7 +212,7 @@ def run_tests(self, test_labels, extra_tests=None): + nose_argv.extend(settings.NOSE_ARGS) + + # Skip over 'manage.py test' and any arguments handled by django. +- django_opts = ['--noinput', '--liveserver', '-p', '--pattern'] ++ django_opts = self.django_opts[:] + for opt in BaseCommand.option_list: + django_opts.extend(opt._long_opts) + django_opts.extend(opt._short_opts) +diff --git a/runtests.sh b/runtests.sh +index 7a0c2ce..7066672 100755 +--- a/runtests.sh ++++ b/runtests.sh +@@ -47,6 +47,7 @@ django_test 'django-admin.py test --settings=testapp.settings_old_style' '2' 'dj + django_test 'testapp/runtests.py testapp.test_only_this' '1' 'via run_tests API' + django_test 'django-admin.py test --settings=testapp.settings_with_plugins testapp/plugin_t' '1' 'with plugins' + django_test 'django-admin.py test --settings=testapp.settings unittests' '4' 'unittests' ++django_test 'django-admin.py test --settings=testapp.settings unittests --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner' '4' 'unittests' + if ! [ $(version $PYTHONVERSION) \> $(version 3.0.0) ] + then + # Python 3 doesn't support the hotshot profiler. See nose#842. +diff --git a/testapp/custom_runner.py b/testapp/custom_runner.py +new file mode 100644 +index 0000000..b7e83ae +--- /dev/null ++++ b/testapp/custom_runner.py +@@ -0,0 +1,5 @@ ++from django_nose import NoseTestSuiteRunner ++ ++ ++class CustomNoseTestSuiteRunner(NoseTestSuiteRunner): ++ pass diff --git a/SOURCES/convert-nose-optparse-options.patch b/SOURCES/convert-nose-optparse-options.patch new file mode 100644 index 0000000..786376d --- /dev/null +++ b/SOURCES/convert-nose-optparse-options.patch @@ -0,0 +1,169 @@ +From 5c936915b3964e7f71c568219693e43f319b50ca Mon Sep 17 00:00:00 2001 +From: John Whitlock +Date: Wed, 8 Apr 2015 17:19:43 -0500 +Subject: [PATCH] Convert nose optparse options to argparse + +When django.core.management.base.BaseCommand includes 'use_argparse', +then nose's optparse options are merged using argparse's +parser.add_argument in BaseCommand's overriden add_arguments method. + +For Django 1.7 and earlier, the current .options method is used to set +the options. + +Fixes #178. +--- + django_nose/runner.py | 134 +++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 126 insertions(+), 8 deletions(-) + +diff --git a/django_nose/runner.py b/django_nose/runner.py +index b99d7fb..b30fdb3 100644 +--- a/django_nose/runner.py ++++ b/django_nose/runner.py +@@ -143,7 +143,132 @@ def _get_options(): + o.action != 'help') + + +-class BasicNoseRunner(DiscoverRunner): ++if hasattr(BaseCommand, 'use_argparse'): ++ # Django 1.8 and later uses argparse.ArgumentParser ++ # Translate nose optparse arguments to argparse ++ class BaseRunner(DiscoverRunner): ++ ++ # Don't pass the following options to nosetests ++ django_opts = [ ++ '--noinput', '--liveserver', '-p', '--pattern', '--testrunner', ++ '--settings'] ++ ++ # ++ # For optparse -> argparse conversion ++ # ++ # Option strings to remove from Django options if found ++ _argparse_remove_options = ( ++ '-p', # Short arg for nose's --plugins, not Django's --patterns ++ '-d', # Short arg for nose's --detailed-errors, not Django's ++ # --debug-sql ++ ) ++ ++ # Convert nose optparse options to argparse options ++ _argparse_type = { ++ 'int': int, ++ 'float': float, ++ 'complex': complex, ++ 'string': str, ++ } ++ # If optparse has a None argument, omit from call to add_argument ++ _argparse_omit_if_none = ( ++ 'action', 'nargs', 'const', 'default', 'type', 'choices', ++ 'required', 'help', 'metavar', 'dest', 'callback', 'callback_args', ++ 'callback_kwargs') ++ ++ # Translating callbacks is not supported, because none of the built-in ++ # plugins uses one. If you have a plugin that uses a callback, please ++ # open a ticket or submit a working implementation. ++ _argparse_fail_if_not_none = ( ++ 'callback', 'callback_args', 'callback_kwargs') ++ ++ @classmethod ++ def add_arguments(cls, parser): ++ """Convert nose's optparse arguments to argparse""" ++ super(BaseRunner, cls).add_arguments(parser) ++ ++ # Read optparse options for nose and plugins ++ cfg_files = nose.core.all_config_files() ++ manager = nose.core.DefaultPluginManager() ++ config = nose.core.Config( ++ env=os.environ, files=cfg_files, plugins=manager) ++ config.plugins.addPlugins(list(_get_plugins_from_settings())) ++ options = config.getParser()._get_all_options() ++ ++ # Gather existing option strings` ++ django_options = set() ++ for action in parser._actions: ++ for override in cls._argparse_remove_options: ++ if override in action.option_strings: ++ # Emulate parser.conflict_handler='resolve' ++ parser._handle_conflict_resolve( ++ None, ((override, action),)) ++ django_options.update(action.option_strings) ++ ++ # Process nose optparse options ++ for option in options: ++ # Skip any options also in Django options ++ opt_long = option.get_opt_string() ++ if opt_long in django_options: ++ continue ++ if option._short_opts: ++ opt_short = option._short_opts[0] ++ if opt_short in django_options: ++ continue ++ else: ++ opt_short = None ++ ++ # Rename nose's --verbosity to --nose-verbosity ++ if opt_long == '--verbosity': ++ opt_long = '--nose-verbosity' ++ ++ # Convert optparse attributes to argparse attributes ++ option_attrs = {} ++ for attr in option.ATTRS: ++ value = getattr(option, attr) ++ ++ # Rename options for nose's --verbosity ++ if opt_long == '--nose-verbosity': ++ if attr == 'dest': ++ value = 'nose_verbosity' ++ elif attr == 'metavar': ++ value = 'NOSE_VERBOSITY' ++ ++ # Omit arguments that are None, use default ++ if attr in cls._argparse_omit_if_none and value is None: ++ continue ++ ++ # Translating callbacks is not supported ++ if attr in cls._argparse_fail_if_not_none: ++ assert value is None, ( ++ 'argparse option %s=%s is not supported' % ++ (attr, value)) ++ continue ++ ++ # Convert type from optparse string to argparse type ++ if attr == 'type': ++ value = cls._argparse_type[value] ++ ++ # Pass converted attribute to optparse option ++ option_attrs[attr] = value ++ ++ # Add the optparse argument ++ if opt_short: ++ parser.add_argument(opt_short, opt_long, **option_attrs) ++ else: ++ parser.add_argument(opt_long, **option_attrs) ++else: ++ # Django 1.7 and earlier use optparse ++ class BaseRunner(DiscoverRunner): ++ # Replace the builtin options with the merged django/nose options: ++ options = _get_options() ++ ++ # Not add following options to nosetests ++ django_opts = ['--noinput', '--liveserver', '-p', '--pattern', ++ '--testrunner'] ++ ++ ++class BasicNoseRunner(BaseRunner): + """Facade that implements a nose runner in the guise of a Django runner + + You shouldn't have to use this directly unless the additions made by +@@ -153,13 +278,6 @@ class BasicNoseRunner(DiscoverRunner): + """ + __test__ = False + +- # Replace the builtin command options with the merged django/nose options: +- options = _get_options() +- +- # Not add following options to nosetests +- django_opts = ['--noinput', '--liveserver', '-p', '--pattern', +- '--testrunner'] +- + def run_suite(self, nose_argv): + result_plugin = ResultPlugin() + plugins_to_add = [DjangoSetUpPlugin(self), diff --git a/SOURCES/python-django-nose-django18-compat.patch b/SOURCES/python-django-nose-django18-compat.patch new file mode 100644 index 0000000..0363911 --- /dev/null +++ b/SOURCES/python-django-nose-django18-compat.patch @@ -0,0 +1,29 @@ +From 08bc8e5efc0e89bbce4ca2a3bf5a5bcdb49ae43c Mon Sep 17 00:00:00 2001 +From: Tim Child +Date: Mon, 9 Feb 2015 10:30:50 +0100 +Subject: [PATCH] Django 1.8 compatibility + +Django 1.8 has changed the way that the database backends are loaded, https://github.com/django/django/pull/3899 +--- + django_nose/runner.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/django_nose/runner.py b/django_nose/runner.py +index ee21cab..d291913 100644 +--- a/django_nose/runner.py ++++ b/django_nose/runner.py +@@ -20,7 +20,13 @@ + from django.core.management.color import no_style + from django.core.management.commands.loaddata import Command + from django.db import connections, transaction, DEFAULT_DB_ALIAS +-from django.db.backends.creation import BaseDatabaseCreation ++ ++try: ++ from django.db.backends.base.creation import BaseDatabaseCreation ++except ImportError: ++ # Django < 1.7 ++ from django.db.backends.creation import BaseDatabaseCreation ++ + from django.utils.importlib import import_module + + try: diff --git a/SPECS/python-django-nose.spec b/SPECS/python-django-nose.spec new file mode 100644 index 0000000..0f1ecd5 --- /dev/null +++ b/SPECS/python-django-nose.spec @@ -0,0 +1,162 @@ +%global pkgname django-nose + +Name: python-django-nose +Version: 1.4.7 +Release: 3%{?dist} +Summary: Django test runner that uses nose + +License: BSD +URL: https://github.com/jbalogh/django-nose +Source0: https://files.pythonhosted.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools + + +%global _description\ +Django test runner that uses nose. + +%description %_description + +%package -n python3-%{pkgname} +Summary: Django test runner that uses nose +Requires: python3-nose +Requires: python3-django + +%description -n python3-%{pkgname} %_description + +%prep +%autosetup -n %{pkgname}-%{version} + +%build +%py3_build + + +%install +%py3_install + +# remove testapp +rm -rf %{buildroot}/%{python3_sitelib}/testapp + + +%files -n python3-%{pkgname} +%doc README.rst +%license LICENSE +%{python3_sitelib}/django_nose +%{python3_sitelib}/django_nose-%{version}-py%{python3_version}.egg-info + + +%changelog +* Wed Jan 27 2021 Fedora Release Engineering - 1.4.7-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Sep 08 2020 Joel Capitao - 1.4.7-2 +- fix hash sum mismatch + +* Tue Sep 08 2020 Joel Capitao - 1.4.7-1 +- update to 1.4.7 + +* Wed Jul 29 2020 Fedora Release Engineering - 1.4.5-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 1.4.5-12 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 1.4.5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 1.4.5-10 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 1.4.5-9 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 1.4.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 1.4.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 1.4.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 1.4.5-5 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 1.4.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Jan 30 2018 Matthias Runge - 1.4.5-3 +- drop Python2 subpackage for https://fedoraproject.org/wiki/Changes/Django20 + +* Fri Jan 26 2018 Matthias Runge - 1.4.5-2 +- fix python2 requires, fix python2-django requires + +* Mon Oct 23 2017 Matthias Runge - 1.4.5-1 +- update to 1.4.5 (rhbz#1504626) + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 1.4.3-6 +- Python 2 binary package renamed to python2-django-nose + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Jul 27 2017 Fedora Release Engineering - 1.4.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 1.4.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 1.4.3-3 +- Rebuild for Python 3.6 + +* Tue Jul 19 2016 Fedora Release Engineering - 1.4.3-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Sat May 21 2016 Matthias Runge - 1.4.3-1 +- modernize spec file, provide python3-package (rhbz#1311551) +- update to 1.4.3 + +* Thu Feb 04 2016 Fedora Release Engineering - 1.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Aug 04 2015 Matthias Runge - 1.4.1-1 +- update to 1.4.1 + +* Thu Jun 18 2015 Fedora Release Engineering - 1.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue Apr 14 2015 Matthias Runge - 1.3-2 +- Convert nose optparse options to argparse + +* Fri Feb 27 2015 Matthias Runge - 1.3-1 +- update to 1.3 +- add patch for Django-1.8 compatibility + +* Sat Jun 07 2014 Fedora Release Engineering - 1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Mar 28 2014 Matthias Runge - 1.2-1 +- update to 1.2 + +* Sun Aug 04 2013 Fedora Release Engineering - 1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 1.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Apr 17 2012 Matthias Runge - 1.0-3 +- update provides for django-nose + +* Fri Mar 23 2012 Matthias Runge - 1.0-2 +- change requirement from Django to python-django + +* Fri Mar 16 2012 Matthias Runge - 1.0-1 +- update to 1.0 from upstream +- more explicit %%files-section +- remove bundled egg-info + +* Tue Jan 31 2012 Matthias Runge - 0.1.3-1 +- initial packaging