From 650bf6714d5648811a8bc08ce53b7fa86cc38d40 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 15 May 2017 09:26:38 -0400 Subject: Refs #27996 -- Skipped RandomUUID test on PostgreSQL 9.3. --- tests/postgres_tests/__init__.py | 10 ++++++++++ tests/postgres_tests/test_functions.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/postgres_tests') diff --git a/tests/postgres_tests/__init__.py b/tests/postgres_tests/__init__.py index 24d78c9bfe..ea6b96aff9 100644 --- a/tests/postgres_tests/__init__.py +++ b/tests/postgres_tests/__init__.py @@ -7,6 +7,16 @@ from django.db.backends.signals import connection_created from django.test import TestCase, modify_settings +def skipUnlessPG94(test): + try: + PG_VERSION = connection.pg_version + except AttributeError: + PG_VERSION = 0 + if PG_VERSION < 90400: + return unittest.skip('PostgreSQL ≥ 9.4 required')(test) + return test + + @unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests") class PostgreSQLTestCase(TestCase): @classmethod diff --git a/tests/postgres_tests/test_functions.py b/tests/postgres_tests/test_functions.py index 875a4b9520..de5cb4d767 100644 --- a/tests/postgres_tests/test_functions.py +++ b/tests/postgres_tests/test_functions.py @@ -4,7 +4,7 @@ from time import sleep from django.contrib.postgres.functions import RandomUUID, TransactionNow -from . import PostgreSQLTestCase +from . import PostgreSQLTestCase, skipUnlessPG94 from .models import NowTestModel, UUIDTestModel @@ -29,6 +29,7 @@ class TestTransactionNow(PostgreSQLTestCase): self.assertEqual(m1.when, m2.when) +@skipUnlessPG94 class TestRandomUUID(PostgreSQLTestCase): def test_random_uuid(self): -- cgit v1.3