Commit 97f5fe03 by Jeremy Bowman

Fixes for pytest database usage

parent cebf6d3e
...@@ -8,6 +8,7 @@ from unittest import skip ...@@ -8,6 +8,7 @@ from unittest import skip
from uuid import uuid4 from uuid import uuid4
import ddt import ddt
import pytest
from dateutil.tz import tzutc from dateutil.tz import tzutc
from django.conf import settings from django.conf import settings
from lazy.lazy import lazy from lazy.lazy import lazy
...@@ -181,6 +182,7 @@ class MixedWithOptionsTestCase(MixedSplitTestCase): ...@@ -181,6 +182,7 @@ class MixedWithOptionsTestCase(MixedSplitTestCase):
store.update_item(item, ModuleStoreEnum.UserID.test) store.update_item(item, ModuleStoreEnum.UserID.test)
@pytest.mark.django_db
@ddt.ddt @ddt.ddt
class TestCoursewareSearchIndexer(MixedWithOptionsTestCase): class TestCoursewareSearchIndexer(MixedWithOptionsTestCase):
""" Tests the operation of the CoursewareSearchIndexer """ """ Tests the operation of the CoursewareSearchIndexer """
......
...@@ -6,6 +6,7 @@ from cStringIO import StringIO ...@@ -6,6 +6,7 @@ from cStringIO import StringIO
from urlparse import parse_qsl, urlparse, urlunparse from urlparse import parse_qsl, urlparse, urlunparse
import ddt import ddt
import pytest
from django.test import override_settings from django.test import override_settings
from django.utils.http import urlencode, urlquote from django.utils.http import urlencode, urlquote
from mock import Mock, patch from mock import Mock, patch
...@@ -162,6 +163,7 @@ def test_raw_static_check(): ...@@ -162,6 +163,7 @@ def test_raw_static_check():
assert_equals(path, replace_static_urls(path, text)) assert_equals(path, replace_static_urls(path, text))
@pytest.mark.django_db
@patch('static_replace.staticfiles_storage', autospec=True) @patch('static_replace.staticfiles_storage', autospec=True)
@patch('static_replace.modulestore', autospec=True) @patch('static_replace.modulestore', autospec=True)
def test_static_url_with_query(mock_modulestore, mock_storage): def test_static_url_with_query(mock_modulestore, mock_storage):
......
...@@ -7,6 +7,7 @@ import json ...@@ -7,6 +7,7 @@ import json
import unittest import unittest
import mock import mock
from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.timezone import utc from django.utils.timezone import utc
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
...@@ -65,7 +66,7 @@ class TestHandleDashboardError(unittest.TestCase): ...@@ -65,7 +66,7 @@ class TestHandleDashboardError(unittest.TestCase):
@attr(shard=1) @attr(shard=1)
class TestRequireStudentIdentifier(unittest.TestCase): class TestRequireStudentIdentifier(TestCase):
""" """
Test require_student_from_identifier() Test require_student_from_identifier()
""" """
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
Test the user api's partition extensions. Test the user api's partition extensions.
""" """
from collections import defaultdict from collections import defaultdict
import pytest
from django.test import TestCase from django.test import TestCase
from mock import patch from mock import patch
...@@ -32,6 +34,7 @@ class MemoryCourseTagAPI(object): ...@@ -32,6 +34,7 @@ class MemoryCourseTagAPI(object):
return False return False
@pytest.mark.django_db
class TestRandomUserPartitionScheme(PartitionTestCase): class TestRandomUserPartitionScheme(PartitionTestCase):
""" """
Test getting a user's group out of a partition Test getting a user's group out of a partition
......
"""Tests covering time zone utilities.""" """Tests covering time zone utilities."""
from unittest import TestCase from django.test import TestCase
from freezegun import freeze_time from freezegun import freeze_time
from pytz import timezone, utc from pytz import timezone, utc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment