[Python-modules-commits] [django-reversion] 04/09: merge patched into master
Michael Fladischer
fladi at moszumanska.debian.org
Thu Jun 22 08:20:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-reversion.
commit 0a76e3739503dc0aa2e6001f4277e82e68822915
Merge: 69db10f b96c3c6
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Thu Jun 22 08:53:35 2017 +0200
merge patched into master
CHANGELOG.rst | 13 ++++++++
debian/.git-dpm | 6 ++--
.../0001-Skip-postgresql-and-mysql-tests.patch | 12 ++++----
docs/_include/create-revision-args.rst | 3 ++
docs/_include/create-revision-atomic.rst | 1 +
docs/admin.rst | 3 ++
docs/api.rst | 4 +--
docs/commands.rst | 5 +++
docs/common-problems.rst | 2 +-
docs/django-versions.rst | 6 ++--
docs/middleware.rst | 5 +++
docs/views.rst | 2 +-
reversion/__init__.py | 2 +-
reversion/middleware.py | 14 +++++++--
reversion/migrations/0003_auto_20160601_1600.py | 27 +++++++++-------
reversion/revisions.py | 36 ++++++++++++++++++----
reversion/views.py | 7 +++--
tests/test_app/tests/base.py | 14 +++++++--
tests/test_app/tests/test_api.py | 15 ++++++++-
tests/test_app/tests/test_models.py | 15 ++++++++-
tox.ini | 10 ++++--
21 files changed, 156 insertions(+), 46 deletions(-)
diff --cc debian/.git-dpm
index 4fc3628,0000000..6fabc3a
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
+# see git-dpm(1) from git-dpm package
- 5ed00b6fbaa729dd8f0d35f61317def312db3226
- 5ed00b6fbaa729dd8f0d35f61317def312db3226
- 8cbfa911be50fa4eab5d6fef8ce1f4aafe6843cb
++b96c3c6a76080533f574a54325130e5b9c2f6b5e
++b96c3c6a76080533f574a54325130e5b9c2f6b5e
++181bad9c2b1870ecb6d5cffdb213051ff145bc19
+181bad9c2b1870ecb6d5cffdb213051ff145bc19
+django-reversion_2.0.9.orig.tar.gz
+e4b064d8d17e340eff261667b2cf87a813e3042a
+63357
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --cc debian/patches/0001-Skip-postgresql-and-mysql-tests.patch
index 1db9cb6,0000000..816261c
mode 100644,000000..100644
--- a/debian/patches/0001-Skip-postgresql-and-mysql-tests.patch
+++ b/debian/patches/0001-Skip-postgresql-and-mysql-tests.patch
@@@ -1,297 -1,0 +1,297 @@@
- From 5ed00b6fbaa729dd8f0d35f61317def312db3226 Mon Sep 17 00:00:00 2001
++From b96c3c6a76080533f574a54325130e5b9c2f6b5e Mon Sep 17 00:00:00 2001
+From: Michael Fladischer <FladischerMichael at fladi.at>
+Date: Tue, 29 Nov 2016 13:34:15 +0100
+Subject: Skip postgresql and mysql tests.
+
+---
+ tests/test_app/tests/test_api.py | 15 +++++++++++++++
+ tests/test_app/tests/test_commands.py | 18 ++++++++++++++++++
+ tests/test_app/tests/test_models.py | 22 ++++++++++++++++++++++
+ tests/test_project/settings.py | 27 +++++++++++++++++++++------
+ 4 files changed, 76 insertions(+), 6 deletions(-)
+
+diff --git a/tests/test_app/tests/test_api.py b/tests/test_app/tests/test_api.py
- index 583bfd7..3c1690e 100644
++index 24201a2..2b8c7bb 100644
+--- a/tests/test_app/tests/test_api.py
++++ b/tests/test_app/tests/test_api.py
+@@ -1,3 +1,4 @@
++import unittest
+ from datetime import timedelta
+ from django.contrib.auth.models import User
+ from django.db import models
- @@ -11,6 +12,16 @@ try:
++@@ -12,6 +13,16 @@ try:
+ except ImportError:
+ from mock import MagicMock
+
++try:
++ import psycopg2
++except ImportError:
++ psycopg2 = None
++
++try:
++ import MySQLdb
++except ImportError:
++ MySQLdb = None
++
+
+ class SaveTest(TestModelMixin, TestBase):
+
- @@ -146,6 +157,8 @@ class CreateRevisionManageManuallyTest(TestModelMixin, TestBase):
++@@ -159,6 +170,8 @@ class CreateRevisionManageManuallyTest(TestModelMixin, TestBase):
+
+ class CreateRevisionDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testCreateRevisionMultiDb(self):
+ with reversion.create_revision(using="mysql"), reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
- @@ -306,6 +319,8 @@ class AddMetaTest(TestModelMixin, TestBase):
++@@ -319,6 +332,8 @@ class AddMetaTest(TestModelMixin, TestBase):
+ with self.assertRaises(reversion.RevisionManagementError):
+ reversion.add_meta(TestMeta, name="meta v1")
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testAddMetaMultDb(self):
+ with reversion.create_revision(using="mysql"), reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
+diff --git a/tests/test_app/tests/test_commands.py b/tests/test_app/tests/test_commands.py
+index bb950ad..0cc406f 100644
+--- a/tests/test_app/tests/test_commands.py
++++ b/tests/test_app/tests/test_commands.py
+@@ -1,3 +1,4 @@
++import unittest
+ from datetime import timedelta
+ from django.core.management import CommandError
+ from django.utils import timezone
+@@ -5,6 +6,16 @@ import reversion
+ from test_app.models import TestModel
+ from test_app.tests.base import TestBase, TestModelMixin
+
++try:
++ import psycopg2
++except ImportError:
++ psycopg2 = None
++
++try:
++ import MySQLdb
++except ImportError:
++ MySQLdb = None
++
+
+ class CreateInitialRevisionsTest(TestModelMixin, TestBase):
+
+@@ -52,12 +63,14 @@ class CreateInitialRevisionsAppLabelTest(TestModelMixin, TestBase):
+
+ class CreateInitialRevisionsDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testCreateInitialRevisionsDb(self):
+ obj = TestModel.objects.create()
+ self.callCommand("createinitialrevisions", using="postgres")
+ self.assertNoRevision()
+ self.assertSingleRevision((obj,), comment="Initial version.", using="postgres")
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testCreateInitialRevisionsDbMySql(self):
+ obj = TestModel.objects.create()
+ self.callCommand("createinitialrevisions", using="mysql")
+@@ -67,6 +80,7 @@ class CreateInitialRevisionsDbTest(TestModelMixin, TestBase):
+
+ class CreateInitialRevisionsModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testCreateInitialRevisionsModelDb(self):
+ obj = TestModel.objects.db_manager("postgres").create()
+ self.callCommand("createinitialrevisions", model_db="postgres")
+@@ -125,18 +139,21 @@ class DeleteRevisionsAppLabelTest(TestModelMixin, TestBase):
+
+ class DeleteRevisionsDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testDeleteRevisionsDb(self):
+ with reversion.create_revision(using="postgres"):
+ TestModel.objects.create()
+ self.callCommand("deleterevisions", using="postgres")
+ self.assertNoRevision(using="postgres")
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testDeleteRevisionsDbMySql(self):
+ with reversion.create_revision(using="mysql"):
+ TestModel.objects.create()
+ self.callCommand("deleterevisions", using="mysql")
+ self.assertNoRevision(using="mysql")
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testDeleteRevisionsDbNoMatch(self):
+ with reversion.create_revision():
+ obj = TestModel.objects.create()
+@@ -146,6 +163,7 @@ class DeleteRevisionsDbTest(TestModelMixin, TestBase):
+
+ class DeleteRevisionsModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testDeleteRevisionsModelDb(self):
+ with reversion.create_revision():
+ TestModel.objects.db_manager("postgres").create()
+diff --git a/tests/test_app/tests/test_models.py b/tests/test_app/tests/test_models.py
- index b8a0bff..9054888 100644
++index f3f13c7..c278385 100644
+--- a/tests/test_app/tests/test_models.py
++++ b/tests/test_app/tests/test_models.py
+@@ -1,9 +1,20 @@
++import unittest
+ from django.utils.encoding import force_text
+ import reversion
+ from reversion.models import Version
+ from test_app.models import TestModel, TestModelRelated, TestModelParent
+ from test_app.tests.base import TestBase, TestModelMixin, TestModelParentMixin
+
++try:
++ import psycopg2
++except ImportError:
++ psycopg2 = None
++
++try:
++ import MySQLdb
++except ImportError:
++ MySQLdb = None
++
+
+ class GetForModelTest(TestModelMixin, TestBase):
+
+@@ -15,11 +26,13 @@ class GetForModelTest(TestModelMixin, TestBase):
+
+ class GetForModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetForModelDb(self):
+ with reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
+ self.assertEqual(Version.objects.using("postgres").get_for_model(obj.__class__).count(), 1)
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testGetForModelDbMySql(self):
+ with reversion.create_revision(using="mysql"):
+ obj = TestModel.objects.create()
+@@ -57,12 +70,14 @@ class GetForObjectTest(TestModelMixin, TestBase):
+
+ class GetForObjectDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetForObjectDb(self):
+ with reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
+ self.assertEqual(Version.objects.get_for_object(obj).count(), 0)
+ self.assertEqual(Version.objects.using("postgres").get_for_object(obj).count(), 1)
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testGetForObjectDbMySql(self):
+ with reversion.create_revision(using="mysql"):
+ obj = TestModel.objects.create()
+@@ -72,6 +87,7 @@ class GetForObjectDbTest(TestModelMixin, TestBase):
+
+ class GetForObjectModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetForObjectModelDb(self):
+ with reversion.create_revision():
+ obj = TestModel.objects.db_manager("postgres").create()
+@@ -128,6 +144,7 @@ class GetForObjectReferenceTest(TestModelMixin, TestBase):
+
+ class GetForObjectReferenceDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetForObjectReferenceModelDb(self):
+ with reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
+@@ -137,12 +154,14 @@ class GetForObjectReferenceDbTest(TestModelMixin, TestBase):
+
+ class GetForObjectReferenceModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetForObjectReferenceModelDb(self):
+ with reversion.create_revision():
+ obj = TestModel.objects.db_manager("postgres").create()
+ self.assertEqual(Version.objects.get_for_object_reference(TestModel, obj.pk).count(), 0)
+ self.assertEqual(Version.objects.get_for_object_reference(TestModel, obj.pk, model_db="postgres").count(), 1)
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testGetForObjectReferenceModelDbMySql(self):
+ with reversion.create_revision():
+ obj = TestModel.objects.db_manager("mysql").create()
+@@ -180,6 +199,7 @@ class GetDeletedTest(TestModelMixin, TestBase):
+
+ class GetDeletedDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetDeletedDb(self):
+ with reversion.create_revision(using="postgres"):
+ obj = TestModel.objects.create()
+@@ -187,6 +207,7 @@ class GetDeletedDbTest(TestModelMixin, TestBase):
+ self.assertEqual(Version.objects.get_deleted(TestModel).count(), 0)
+ self.assertEqual(Version.objects.using("postgres").get_deleted(TestModel).count(), 1)
+
++ @unittest.skipIf(not MySQLdb, "MySQLdb not installed")
+ def testGetDeletedDbMySql(self):
+ with reversion.create_revision(using="mysql"):
+ obj = TestModel.objects.create()
+@@ -197,6 +218,7 @@ class GetDeletedDbTest(TestModelMixin, TestBase):
+
+ class GetDeletedModelDbTest(TestModelMixin, TestBase):
+
++ @unittest.skipIf(not psycopg2, "psycopg2 not installed")
+ def testGetDeletedModelDb(self):
+ with reversion.create_revision():
+ obj = TestModel.objects.db_manager("postgres").create()
+diff --git a/tests/test_project/settings.py b/tests/test_project/settings.py
+index 395a30e..46f073e 100644
+--- a/tests/test_project/settings.py
++++ b/tests/test_project/settings.py
+@@ -13,6 +13,17 @@ https://docs.djangoproject.com/en/dev/ref/settings/
+ import os
+ import getpass
+
++try:
++ import psycopg2
++except ImportError:
++ psycopg2 = None
++
++try:
++ import MySQLdb
++except ImportError:
++ MySQLdb = None
++
++
+ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+@@ -81,20 +92,24 @@ DATABASES = {
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
+- },
+- "postgres": {
++ }
++}
++
++if psycopg2:
++ DATABASES["postgres"] = {
+ "ENGINE": "django.db.backends.postgresql_psycopg2",
+ "NAME": os.environ.get("DJANGO_DATABASE_NAME_POSTGRES", "test_project"),
+ "USER": os.environ.get("DJANGO_DATABASE_USER_POSTGRES", getpass.getuser()),
+ "PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD_POSTGRES", ""),
+- },
+- "mysql": {
++ }
++
++if MySQLdb:
++ DATABASES["mysql"] = {
+ "ENGINE": "django.db.backends.mysql",
+ "NAME": os.environ.get("DJANGO_DATABASE_NAME_MYSQL", "test_project"),
+ "USER": os.environ.get("DJANGO_DATABASE_USER_MYSQL", getpass.getuser()),
+ "PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD_MYSQL", ""),
+- },
+-}
++ }
+
+
+ # Password validation
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-reversion.git
More information about the Python-modules-commits
mailing list