Skip to content

Commit

Permalink
Move tests to test
Browse files Browse the repository at this point in the history
  • Loading branch information
kaedroho authored and gasman committed Mar 17, 2022
1 parent 6e17716 commit 0fd9988
Show file tree
Hide file tree
Showing 360 changed files with 317 additions and 322 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- image: cimg/python:3.8.11-browsers
environment:
PIPENV_VENV_IN_PROJECT: true
DJANGO_SETTINGS_MODULE: wagtail.tests.settings_ui
DJANGO_SETTINGS_MODULE: wagtail.test.settings_ui
steps:
- checkout
- attach_workspace:
Expand All @@ -87,13 +87,13 @@ jobs:
key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
paths:
- client/tests/integration/node_modules
- run: pipenv run ./wagtail/tests/manage.py migrate
- run: pipenv run ./wagtail/test/manage.py migrate
- run:
command: pipenv run ./wagtail/tests/manage.py runserver 0:8000
command: pipenv run ./wagtail/test/manage.py runserver 0:8000
background: true
- run: pipenv run ./wagtail/tests/manage.py createcachetable
- run: pipenv run ./wagtail/test/manage.py createcachetable
- run:
command: pipenv run ./wagtail/tests/manage.py createsuperuser --noinput
command: pipenv run ./wagtail/test/manage.py createsuperuser --noinput
environment:
DJANGO_SUPERUSER_EMAIL: [email protected]
DJANGO_SUPERUSER_USERNAME: admin
Expand Down
6 changes: 3 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def pytest_configure(config):

# Setup django after processing the pytest arguments so that the env
# variables are available in the settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtail.tests.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtail.test.settings")
django.setup()

# Activate a language: This affects HTTP header HTTP_ACCEPT_LANGUAGE sent by
Expand All @@ -54,14 +54,14 @@ def pytest_configure(config):

translation.activate("en")

from wagtail.tests.settings import MEDIA_ROOT, STATIC_ROOT
from wagtail.test.settings import MEDIA_ROOT, STATIC_ROOT

shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)


def pytest_unconfigure(config):
from wagtail.tests.settings import MEDIA_ROOT, STATIC_ROOT
from wagtail.test.settings import MEDIA_ROOT, STATIC_ROOT

shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
8 changes: 4 additions & 4 deletions docs/advanced_topics/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Testing your Wagtail site

Wagtail comes with some utilities that simplify writing tests for your site.

.. automodule:: wagtail.tests.utils
.. automodule:: wagtail.test.utils


WagtailPageTests
Expand All @@ -18,7 +18,7 @@ WagtailPageTests

.. code-block:: python
from wagtail.tests.utils import WagtailPageTests
from wagtail.test.utils import WagtailPageTests
from myapp.models import MyPage
class MyPageTests(WagtailPageTests):
Expand All @@ -45,7 +45,7 @@ WagtailPageTests

.. code-block:: python
from wagtail.tests.utils.form_data import nested_form_data, streamfield
from wagtail.test.utils.form_data import nested_form_data, streamfield
def test_can_create_content_page(self):
# Get the HomePage
Expand Down Expand Up @@ -94,7 +94,7 @@ WagtailPageTests
Form data helpers
=================

.. automodule:: wagtail.tests.utils.form_data
.. automodule:: wagtail.test.utils.form_data

.. autofunction:: nested_form_data

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

# Autodoc may need to import some models modules which require django settings
# be configured
os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.tests.settings"
os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.test.settings"
django.setup()

# Use SQLite3 database engine so it doesn't attempt to use psycopg2 on RTD
Expand Down
14 changes: 7 additions & 7 deletions docs/contributing/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ You can create migrations for the test app by running the following from the Wag

.. code-block:: console
$ django-admin makemigrations --settings=wagtail.tests.settings
$ django-admin makemigrations --settings=wagtail.test.settings
Testing against PostgreSQL
Expand Down Expand Up @@ -188,12 +188,12 @@ Our end-to-end browser testing suite also uses `Jest <https://jestjs.io/>`_, com

.. code-block:: console
$ export DJANGO_SETTINGS_MODULE=wagtail.tests.settings_ui
$ export DJANGO_SETTINGS_MODULE=wagtail.test.settings_ui
$ # Assumes the current environment contains a valid installation of Wagtail for local development.
$ ./wagtail/tests/manage.py migrate
$ ./wagtail/tests/manage.py createcachetable
$ [email protected] DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=changeme ./wagtail/tests/manage.py createsuperuser --noinput
$ ./wagtail/tests/manage.py runserver 0:8000
$ ./wagtail/test/manage.py migrate
$ ./wagtail/test/manage.py createcachetable
$ [email protected] DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=changeme ./wagtail/test/manage.py createsuperuser --noinput
$ ./wagtail/test/manage.py runserver 0:8000
$ npm --prefix client/tests/integration install
$ npm run test:integration
Expand Down Expand Up @@ -289,7 +289,7 @@ Wagtail’s UI component library is built with `Storybook <https://storybook.js.

.. code-block:: console
$ export DJANGO_SETTINGS_MODULE=wagtail.tests.settings_ui
$ export DJANGO_SETTINGS_MODULE=wagtail.test.settings_ui
$ # Assumes the current environment contains a valid installation of Wagtail for local development.
$ ./wagtail/tests/manage.py migrate
$ ./wagtail/tests/manage.py createcachetable
Expand Down
2 changes: 1 addition & 1 deletion docs/releases/2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Wagtail now provides a set of helper functions for constructing form data: see :

.. code-block:: python
from wagtail.tests.utils.form_data import rich_text
from wagtail.test.utils.form_data import rich_text
self.assertCanCreate(root_page, ContentPage, {
'title': 'About us',
Expand Down
4 changes: 2 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django.core.management import execute_from_command_line

os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.tests.settings"
os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.test.settings"


def make_parser():
Expand Down Expand Up @@ -92,7 +92,7 @@ def runtests():
try:
execute_from_command_line(argv)
finally:
from wagtail.tests.settings import MEDIA_ROOT, STATIC_ROOT
from wagtail.test.settings import MEDIA_ROOT, STATIC_ROOT

shutil.rmtree(STATIC_ROOT, ignore_errors=True)
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/api/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from wagtail.api.v2.tests.test_pages import TestPageDetail, TestPageListing
from wagtail.core import hooks
from wagtail.core.models import GroupPagePermission, Locale, Page, PageLogEntry
from wagtail.tests.demosite import models
from wagtail.tests.testapp.models import EventIndex, EventPage, SimplePage, StreamPage
from wagtail.test.demosite import models
from wagtail.test.testapp.models import EventIndex, EventPage, SimplePage, StreamPage
from wagtail.users.models import UserProfile

from .utils import AdminAPITestCase
Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/tests/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase

from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.utils import WagtailTestUtils


class AdminAPITestCase(TestCase, WagtailTestUtils):
Expand Down
6 changes: 3 additions & 3 deletions wagtail/admin/tests/benches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from django.utils import timezone

from wagtail.core.models import Page, Site
from wagtail.tests.benchmark import Benchmark
from wagtail.tests.testapp.models import SingleEventPage, StreamPage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.benchmark import Benchmark
from wagtail.test.testapp.models import SingleEventPage, StreamPage
from wagtail.test.utils import WagtailTestUtils


class BenchPageExplorerWith50LargePages(Benchmark, WagtailTestUtils, TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.test import TestCase
from django.urls import reverse

from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.utils import WagtailTestUtils


class TestBulkActionDispatcher(TestCase, WagtailTestUtils):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkAction
from wagtail.core.models import Page
from wagtail.core.signals import page_unpublished
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestBulkDelete(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_bulk_actions/test_bulk_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkAction
from wagtail.core.models import Page
from wagtail.core.signals import post_page_move, pre_page_move
from wagtail.tests.testapp.models import BusinessChild, SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import BusinessChild, SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestBulkMove(TestCase, WagtailTestUtils):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkAction
from wagtail.core.models import Page
from wagtail.core.signals import page_published
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestBulkPublish(TestCase, WagtailTestUtils):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkAction
from wagtail.core.models import Page
from wagtail.core.signals import page_unpublished
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestBulkUnpublish(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_content_type_use_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from django.urls import reverse
from django.utils.http import urlencode

from wagtail.tests.testapp.models import EventPage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import EventPage
from wagtail.test.utils import WagtailTestUtils


class TestContentTypeUse(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_convert_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.urls import reverse

from wagtail.core.models import Page, PageLogEntry
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestConvertAlias(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_copy_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.urls import reverse

from wagtail.core.models import GroupPagePermission, Page
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestPageCopy(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_create_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from wagtail.admin.tests.pages.timestamps import submittable_timestamp
from wagtail.core.models import GroupPagePermission, Locale, Page, PageRevision
from wagtail.core.signals import page_published
from wagtail.tests.testapp.models import (
from wagtail.test.testapp.models import (
BusinessChild,
BusinessIndex,
BusinessSubIndex,
Expand All @@ -24,7 +24,7 @@
StandardChild,
StandardIndex,
)
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.utils import WagtailTestUtils


class TestPageCreation(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from wagtail.admin.views.home import RecentEditsPanel
from wagtail.core.models import Page
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestRecentEditsPanel(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_delete_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from wagtail.core.models import Page
from wagtail.core.signals import page_unpublished
from wagtail.tests.testapp.models import SimplePage, StandardChild, StandardIndex
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage, StandardChild, StandardIndex
from wagtail.test.utils import WagtailTestUtils


class TestPageDelete(TestCase, WagtailTestUtils):
Expand Down
6 changes: 3 additions & 3 deletions wagtail/admin/tests/pages/test_edit_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Site,
)
from wagtail.core.signals import page_published
from wagtail.tests.testapp.models import (
from wagtail.test.testapp.models import (
EVENT_AUDIENCE_CHOICES,
Advert,
AdvertPlacement,
Expand All @@ -41,8 +41,8 @@
StandardIndex,
TaggedPage,
)
from wagtail.tests.utils import WagtailTestUtils
from wagtail.tests.utils.form_data import inline_formset, nested_form_data
from wagtail.test.utils import WagtailTestUtils
from wagtail.test.utils.form_data import inline_formset, nested_form_data
from wagtail.users.models import UserProfile


Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_explorer_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from wagtail.admin.tests.pages.timestamps import local_datetime
from wagtail.core import hooks
from wagtail.core.models import GroupPagePermission, Locale, Page
from wagtail.tests.testapp.models import SimplePage, SingleEventPage, StandardIndex
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage, SingleEventPage, StandardIndex
from wagtail.test.utils import WagtailTestUtils


class TestPageExplorer(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

from wagtail.core.models import Page, PageRevision
from wagtail.core.signals import page_published
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils
from wagtail.users.models import UserProfile


Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_move_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from wagtail.admin.navigation import get_explorable_root_page
from wagtail.core.models import Page
from wagtail.core.signals import post_page_move, pre_page_move
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestPageMove(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_page_locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.utils import timezone

from wagtail.core.models import Page
from wagtail.tests.testapp.models import SimplePage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage
from wagtail.test.utils import WagtailTestUtils


class TestLocking(TestCase, WagtailTestUtils):
Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/tests/pages/test_page_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from wagtail.admin.tests.pages.timestamps import local_datetime
from wagtail.core.models import Page
from wagtail.search.index import SearchField
from wagtail.tests.testapp.models import SimplePage, SingleEventPage
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.testapp.models import SimplePage, SingleEventPage
from wagtail.test.utils import WagtailTestUtils


class TestPageSearch(TestCase, WagtailTestUtils):
Expand Down
Loading

0 comments on commit 0fd9988

Please sign in to comment.