Fixes for pytest database usage

This commit is contained in:
Jeremy Bowman
2017-09-06 13:15:34 -04:00
parent cebf6d3ea9
commit 97f5fe035b
5 changed files with 10 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ from unittest import skip
from uuid import uuid4
import ddt
import pytest
from dateutil.tz import tzutc
from django.conf import settings
from lazy.lazy import lazy
@@ -181,6 +182,7 @@ class MixedWithOptionsTestCase(MixedSplitTestCase):
store.update_item(item, ModuleStoreEnum.UserID.test)
@pytest.mark.django_db
@ddt.ddt
class TestCoursewareSearchIndexer(MixedWithOptionsTestCase):
""" Tests the operation of the CoursewareSearchIndexer """

View File

@@ -6,6 +6,7 @@ from cStringIO import StringIO
from urlparse import parse_qsl, urlparse, urlunparse
import ddt
import pytest
from django.test import override_settings
from django.utils.http import urlencode, urlquote
from mock import Mock, patch
@@ -162,6 +163,7 @@ def test_raw_static_check():
assert_equals(path, replace_static_urls(path, text))
@pytest.mark.django_db
@patch('static_replace.staticfiles_storage', autospec=True)
@patch('static_replace.modulestore', autospec=True)
def test_static_url_with_query(mock_modulestore, mock_storage):

View File

@@ -7,6 +7,7 @@ import json
import unittest
import mock
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.timezone import utc
from nose.plugins.attrib import attr
@@ -65,7 +66,7 @@ class TestHandleDashboardError(unittest.TestCase):
@attr(shard=1)
class TestRequireStudentIdentifier(unittest.TestCase):
class TestRequireStudentIdentifier(TestCase):
"""
Test require_student_from_identifier()
"""

View File

@@ -2,6 +2,8 @@
Test the user api's partition extensions.
"""
from collections import defaultdict
import pytest
from django.test import TestCase
from mock import patch
@@ -32,6 +34,7 @@ class MemoryCourseTagAPI(object):
return False
@pytest.mark.django_db
class TestRandomUserPartitionScheme(PartitionTestCase):
"""
Test getting a user's group out of a partition

View File

@@ -1,6 +1,5 @@
"""Tests covering time zone utilities."""
from unittest import TestCase
from django.test import TestCase
from freezegun import freeze_time
from pytz import timezone, utc