Browse Source

Hide systematic warning running tests

The input data is how it is, changing it will make the test irrelevant.
Jocelyn Delalande 7 years ago
parent
commit
ad7003506c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      wifiwithme/apps/contribmap/tests.py

+ 8 - 0
wifiwithme/apps/contribmap/tests.py

@@ -1,4 +1,5 @@
 import json
+import warnings
 
 from django.core import mail
 from django.contrib.auth.models import User
@@ -234,6 +235,13 @@ class TestForms(TestCase):
 class TestDataImport(TestCase):
     fixtures = ['bottle_data.yaml']
 
+    @classmethod
+    def setUpClass(cls, *args, **kwargs):
+        # Silence the warnings about naive datetimes contained in the yaml.
+        with warnings.catch_warnings():  # Scope warn catch to this block
+            warnings.simplefilter('ignore', RuntimeWarning)
+            return super().setUpClass(*args, **kwargs)
+
     def test_re_save(self):
         for contrib in Contrib.objects.all():
             contrib.full_clean()