]> git.parisson.com Git - telemeta.git/commitdiff
Fix pytest configuration
authorThomas Fillon <thomas@parisson.com>
Wed, 5 Jul 2017 07:01:10 +0000 (09:01 +0200)
committerThomas Fillon <thomas@parisson.com>
Wed, 5 Jul 2017 07:01:10 +0000 (09:01 +0200)
app/pytest.ini [deleted file]
telemeta/tests/conftest.py [new file with mode: 0644]
telemeta/tests/test_models.py
telemeta/tests/test_utils.py

diff --git a/app/pytest.ini b/app/pytest.ini
deleted file mode 100644 (file)
index b776a95..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[pytest]
-DJANGO_SETTINGS_MODULE=telemeta.tests.settings_sqlite
diff --git a/telemeta/tests/conftest.py b/telemeta/tests/conftest.py
new file mode 100644 (file)
index 0000000..2ced35c
--- /dev/null
@@ -0,0 +1,21 @@
+from django.conf import settings
+
+def pytest_configure():
+    settings.configure(#SECRET_KEY = 'test_key'
+        INSTALLED_APPS=('django.contrib.auth',
+                        'django.contrib.contenttypes',
+                        'django.contrib.sessions',
+                        'django.contrib.sites',
+                        'django.contrib.messages',
+                        'suit',
+                        'django.contrib.admin',
+                        'django.contrib.staticfiles',
+                        'django_extensions',
+                        'telemeta',),
+        DATABASES={
+            'default': {
+                'ENGINE': 'django.db.backends.sqlite3',
+                'NAME': ':memory:'
+            },
+        }
+    )
index f7c652971602b3cec6b3cfe0e8d00e56d7cbc347..b56fbafd1549f364ba61068b5b2714e05a4ba66c 100644 (file)
@@ -20,7 +20,7 @@
 #          David LIPSZYC <davidlipszyc@gmail.com>
 
 from django.contrib.auth.models import User
-from django.test import TestCase
+
 
 from telemeta.models import LocationType, Location, EthnicGroup
 from telemeta.models.enum import Publisher, PublisherCollection
@@ -33,7 +33,7 @@ import pytest
 pytestmark = pytest.mark.django_db
 
 @pytest.mark.django_db
-class CollectionItemTestCase(TestCase):
+class CollectionItemTestCase:
     pytestmark = pytest.mark.django_db
 
     def setUp(self):
@@ -320,7 +320,7 @@ class CollectionItemTestCase(TestCase):
 pytestmark = pytest.mark.django_db
 
 @pytest.mark.django_db
-class RelatedDeleteTestCase(TestCase):
+class RelatedDeleteTestCase:
     pytestmark = pytest.mark.django_db
 
     def setUp(self):
index b71ab33d65f383f46b4c9cc09d5cb57496314da6..c875d09e060f8cc2ddaf6c626cc1b76b4f67ed6f 100644 (file)
 #
 # Authors: Olivier Guilyardi <olivier@samalyse.com>
 
-import unittest
+from django.test import TestCase
 from telemeta.util.unaccent import unaccent_icmp
 
-class UnaccentTestCase(unittest.TestCase):
+class UnaccentTestCase(TestCase):
     def testSorting(self):
         strings = [u'Métro', u'évasion', u'àccent', u'È', u'île', u'arrivée', u'elle']
         strings.sort(unaccent_icmp)