diff --git a/pytest.ini b/pytest.ini --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,3 @@ [pytest] norecursedirs = docs +DJANGO_SETTINGS_MODULE = swh.deposit.settings.testing diff --git a/requirements-test.txt b/requirements-test.txt --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,2 +1,2 @@ -nose -django_nose +pytest +pytest-django diff --git a/swh/deposit/settings/testing.py b/swh/deposit/settings/testing.py --- a/swh/deposit/settings/testing.py +++ b/swh/deposit/settings/testing.py @@ -8,13 +8,10 @@ from .development import * # noqa from .development import INSTALLED_APPS -# django-nose setup +# django setup ALLOWED_HOSTS += ['testserver'] -INSTALLED_APPS += ['django_nose'] - -TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' -NOSE_ARGS = ['--verbosity=3', '-s'] # to see test pass +INSTALLED_APPS += ['pytest_django'] # https://docs.djangoproject.com/en/1.10/ref/settings/#logging LOGGING = { diff --git a/swh/deposit/tests/api/test_deposit_check.py b/swh/deposit/tests/api/test_deposit_check.py --- a/swh/deposit/tests/api/test_deposit_check.py +++ b/swh/deposit/tests/api/test_deposit_check.py @@ -6,7 +6,7 @@ import unittest from django.core.urlresolvers import reverse -from nose.plugins.attrib import attr +import pytest from rest_framework import status from rest_framework.test import APITestCase @@ -26,7 +26,7 @@ from ..common import FileSystemCreationRoutine -@attr('fs') +@pytest.mark.fs class CheckDepositTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine, FileSystemCreationRoutine): diff --git a/swh/deposit/tests/api/test_deposit_list.py b/swh/deposit/tests/api/test_deposit_list.py --- a/swh/deposit/tests/api/test_deposit_list.py +++ b/swh/deposit/tests/api/test_deposit_list.py @@ -4,7 +4,7 @@ # See top-level LICENSE file for more information from django.core.urlresolvers import reverse -from nose.plugins.attrib import attr +import pytest from rest_framework import status from rest_framework.test import APITestCase @@ -15,7 +15,7 @@ from ...models import Deposit -@attr('fs') +@pytest.mark.fs class CheckDepositListTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine): """Check deposit list endpoints. diff --git a/swh/deposit/tests/api/test_deposit_read_archive.py b/swh/deposit/tests/api/test_deposit_read_archive.py --- a/swh/deposit/tests/api/test_deposit_read_archive.py +++ b/swh/deposit/tests/api/test_deposit_read_archive.py @@ -7,7 +7,7 @@ import os from django.core.urlresolvers import reverse -from nose.plugins.attrib import attr +import pytest from rest_framework import status from rest_framework.test import APITestCase @@ -19,7 +19,7 @@ from ..common import FileSystemCreationRoutine, create_arborescence_archive -@attr('fs') +@pytest.mark.fs class DepositReadArchivesTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine, FileSystemCreationRoutine): diff --git a/swh/deposit/tests/common.py b/swh/deposit/tests/common.py --- a/swh/deposit/tests/common.py +++ b/swh/deposit/tests/common.py @@ -13,7 +13,7 @@ from django.core.urlresolvers import reverse from django.test import TestCase from io import BytesIO -from nose.plugins.attrib import attr +import pytest from rest_framework import status from swh.deposit.config import (COL_IRI, EM_IRI, EDIT_SE_IRI, @@ -138,7 +138,7 @@ return compute_info(invalid_archive_path) -@attr('fs') +@pytest.mark.fs class FileSystemCreationRoutine(TestCase): """Mixin intended for tests needed to tamper with archives. @@ -264,7 +264,7 @@ return deposit_id -@attr('fs') +@pytest.mark.fs class BasicTestCase(TestCase): """Mixin intended for data setup purposes (user, collection, etc...) diff --git a/swh/deposit/tests/loader/test_client.py b/swh/deposit/tests/loader/test_client.py --- a/swh/deposit/tests/loader/test_client.py +++ b/swh/deposit/tests/loader/test_client.py @@ -8,7 +8,7 @@ import tempfile import unittest -from nose.plugins.attrib import attr +import pytest from swh.deposit.client import PrivateApiDepositClient from swh.deposit.config import DEPOSIT_STATUS_LOAD_SUCCESS @@ -41,7 +41,7 @@ return self.response -@attr('fs') +@pytest.mark.fs class PrivateApiDepositClientReadArchiveTest(unittest.TestCase): def setUp(self): super().setUp() diff --git a/swh/deposit/tests/loader/test_loader.py b/swh/deposit/tests/loader/test_loader.py --- a/swh/deposit/tests/loader/test_loader.py +++ b/swh/deposit/tests/loader/test_loader.py @@ -7,7 +7,7 @@ import unittest import shutil -from nose.plugins.attrib import attr +import pytest from rest_framework.test import APITestCase from swh.model import hashutil @@ -182,7 +182,7 @@ pass -@attr('fs') +@pytest.mark.fs class DepositLoaderScenarioTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine, FileSystemCreationRoutine, TestLoaderUtils):