# -*- coding: utf-8 -*-

"""
Unit testing of the 'objects' Evennia component.

Runs as part of the Evennia's test suite with 'manage.py test"

Please add new tests to this module as needed.

Guidelines:
 A 'test case' is testing a specific component and is defined as a class
 inheriting from unittest.TestCase. The test case class can have a method
 setUp() that creates and sets up the testing environment.
 All methods inside the test case class whose names start with 'test' are
 used as test methods by the runner. Inside the test methods, special member
 methods assert*() are used to test the behaviour.
"""

import os
import sys
import glob

try:
    from django.utils.unittest import TestCase
except ImportError:
    from django.test import TestCase
try:
    from django.utils import unittest
except ImportError:
    import unittest

from django.test.runner import DiscoverRunner


class EvenniaTestSuiteRunner(DiscoverRunner):
    """
    This test runner only runs tests on the apps specified in evennia/
     avoid running the large number of tests defined by Django
    """

    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        """
        Build a test suite for Evennia. test_labels is a list of apps to test.
        If not given, a subset of settings.INSTALLED_APPS will be used.
        """
        import evennia
        evennia._init()
        return super(EvenniaTestSuiteRunner, self).build_suite(test_labels, extra_tests=extra_tests, **kwargs)

@@ -612,43 +612,8 @@
 %22%22%22%0A
-%0Aimport os%0Aimport sys%0Aimport glob%0A%0A
 try:
@@ -848,16 +848,56 @@
 Runner%0A%0A
+from .deprecations import check_errors%0A%0A
 %0Aclass E
@@ -1376,16 +1376,16 @@
 _init()%0A
-
         
@@ -1487,8 +1487,1656 @@
 kwargs)%0A
+%0A%0Aclass MockSettings(object):%0A    %22%22%22%0A    Class for simulating django.conf.settings. Created with a single value, and then sets the required%0A    WEBSERVER_ENABLED setting to True or False depending if we're testing WEBSERVER_PORTS.%0A    %22%22%22%0A    def __init__(self, setting, value=None):%0A        setattr(self, setting, value)%0A        if setting == %22WEBSERVER_PORTS%22:%0A            self.WEBSERVER_ENABLED = True%0A        else:%0A            self.WEBSERVER_ENABLED = False%0A%0A%0Aclass TestDeprecations(TestCase):%0A    %22%22%22%0A    Class for testing deprecations.check_errors.%0A    %22%22%22%0A    deprecated_settings = (%22CMDSET_DEFAULT%22, %22CMDSET_OOC%22, %22BASE_COMM_TYPECLASS%22, %22COMM_TYPECLASS_PATHS%22,%0A                           %22CHARACTER_DEFAULT_HOME%22, %22OBJECT_TYPECLASS_PATHS%22, %22SCRIPT_TYPECLASS_PATHS%22,%0A                           %22ACCOUNT_TYPECLASS_PATHS%22, %22CHANNEL_TYPECLASS_PATHS%22, %22SEARCH_MULTIMATCH_SEPARATOR%22,%0A                           %22TIME_SEC_PER_MIN%22, %22TIME_MIN_PER_HOUR%22, %22TIME_HOUR_PER_DAY%22, %22TIME_DAY_PER_WEEK%22,%0A                           %22TIME_WEEK_PER_MONTH%22, %22TIME_MONTH_PER_YEAR%22)%0A%0A    def test_check_errors(self):%0A        %22%22%22%0A        All settings in deprecated_settings should raise a DeprecationWarning if they exist. WEBSERVER_PORTS%0A        raises an error if the iterable value passed does not have a tuple as its first element.%0A        %22%22%22%0A        for setting in self.deprecated_settings:%0A            self.assertRaises(DeprecationWarning, check_errors, MockSettings(setting))%0A        # test check for WEBSERVER_PORTS having correct value%0A        self.assertRaises(DeprecationWarning, check_errors, MockSettings(%22WEBSERVER_PORTS%22, value=%5B%22not a tuple%22%5D))%0A

Add unit tests for deprecations