Switch to pytest for unit tests

This commit is contained in:
Jeremy Bowman
2017-09-12 17:21:26 -04:00
parent 990a8cbfe6
commit ca97e946a6
30 changed files with 293 additions and 200 deletions

8
common/lib/conftest.py Normal file
View File

@@ -0,0 +1,8 @@
from django.conf import settings
def pytest_configure():
"""
Use Django's default settings for tests in common/lib.
"""
settings.configure()

5
common/lib/pytest.ini Normal file
View File

@@ -0,0 +1,5 @@
[pytest]
addopts = --nomigrations --reuse-db --durations=20
norecursedirs = .cache
python_classes =
python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py

View File

@@ -13,12 +13,6 @@ import uuid
import ddt
from contracts import contract
from nose.plugins.attrib import attr
# For the cache tests to work, we need to be using the Django default
# settings (not our usual cms or lms test settings) and they need to
# be configured before importing from django.core.cache
from django.conf import settings
if not settings.configured:
settings.configure()
from django.core.cache import caches, InvalidCacheBackendError
from openedx.core.lib import tempdir