mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 15:37:17 +02:00
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
# -*- 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)
|