1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,10 +1,3 @@
-from nose import SkipTest
-try:
- import django
-except ImportError:
- raise SkipTest()
-
-
# Setup a Django environment, before we do anything else.
#
# Most Django imports fail one way or another without an
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-from nose import SkipTest
-from nose.tools import assert_raises, assert_raises_regexp
+import pytest
from django.conf import settings
from django.contrib.staticfiles import finders
@@ -30,7 +28,7 @@
- Initialize MEDIA_ROOT to point to a temporary directory.
"""
- def setup(self):
+ def setup_method(self):
TempDirHelper.setup(self)
# Reset the webassets environment.
@@ -51,7 +49,7 @@
self.env.cache = False
self.env.manifest = False
- def teardown(self):
+ def teardown_method(self):
super(TempEnvironmentHelper, self).teardown()
finders.get_finder.cache_clear()
@@ -98,7 +96,7 @@
class TestTemplateTag():
- def setup(self):
+ def setup_method(self):
test_instance = self
class MockBundle(Bundle):
urls_to_fake = ['foo']
@@ -121,7 +119,7 @@
django_env_register('foo_bundle', self.foo_bundle)
django_env_register('bar_bundle', self.bar_bundle)
- def teardown(self):
+ def teardown_method(self):
AssetsNode.BundleClass = self._old_bundle_class
del self._old_bundle_class
@@ -178,7 +176,7 @@
"""
}
- def setup(self):
+ def setup_method(self):
TempDirHelper.setup(self)
self.loader = DjangoLoader()
@@ -209,13 +207,13 @@
"""Test integration with django.contrib.staticfiles.
"""
- def setup(self):
+ def setup_method(self):
try:
import django.contrib.staticfiles
except ImportError:
raise SkipTest()
- TempEnvironmentHelper.setup(self)
+ TempEnvironmentHelper.setup_method(self)
# Configure a staticfiles-using project.
settings.STATIC_ROOT = settings.MEDIA_ROOT # /media via baseclass
@@ -239,7 +237,7 @@
"""
settings.ASSETS_DEBUG = False
bundle = self.mkbundle('file1', 'file2', output="out")
- assert_raises(BundleError, bundle.build)
+ pytest.raises(BundleError, bundle.build)
# After creating the files in the static root directory,
# it works (we only look there in production).
@@ -264,8 +262,7 @@
"""An error is raised if a source file is missing.
"""
bundle = self.mkbundle('xyz', output="out")
- assert_raises_regexp(
- BundleError, 'using staticfiles finders', bundle.build)
+ pytest.raises(BundleError, bundle.build)
def test_serve_built_files(self):
"""The files we write to STATIC_ROOT are served in debug mode
|