rename all test files so that they are prefixed by test_{orginal_filename}.py

This commit is contained in:
Bastien Gérard
2019-08-28 16:01:44 +03:00
parent 99a58d5c91
commit ddececbfea
21 changed files with 90 additions and 155 deletions

View File

@@ -1,13 +0,0 @@
import unittest
from .class_methods import *
from .delta import *
from .dynamic import *
from .indexes import *
from .inheritance import *
from .instance import *
from .json_serialisation import *
from .validation import *
if __name__ == "__main__":
unittest.main()

View File

@@ -2,15 +2,12 @@
import unittest
from mongoengine import *
from mongoengine.pymongo_support import list_collection_names
from mongoengine.queryset import NULLIFY, PULL
from mongoengine.connection import get_db
__all__ = ("ClassMethodsTest",)
from mongoengine.pymongo_support import list_collection_names
from mongoengine.queryset import NULLIFY, PULL
class ClassMethodsTest(unittest.TestCase):
class TestClassMethods(unittest.TestCase):
def setUp(self):
connect(db="mongoenginetest")
self.db = get_db()

View File

@@ -7,9 +7,9 @@ from mongoengine.pymongo_support import list_collection_names
from tests.utils import MongoDBTestCase
class DeltaTest(MongoDBTestCase):
class TestDelta(MongoDBTestCase):
def setUp(self):
super(DeltaTest, self).setUp()
super(TestDelta, self).setUp()
class Person(Document):
name = StringField()

View File

@@ -179,7 +179,7 @@ class TestDynamicDocument(MongoDBTestCase):
def test_three_level_complex_data_lookups(self):
"""Ensure you can query three level document dynamic fields"""
p = self.Person.objects.create(misc={"hello": {"hello2": "world"}})
self.Person.objects.create(misc={"hello": {"hello2": "world"}})
self.assertEqual(1, self.Person.objects(misc__hello__hello2="world").count())
def test_complex_embedded_document_validation(self):

View File

@@ -4,16 +4,13 @@ from datetime import datetime
from nose.plugins.skip import SkipTest
from pymongo.errors import OperationFailure
import pymongo
from six import iteritems
from mongoengine import *
from mongoengine.connection import get_db
__all__ = ("IndexesTest",)
class IndexesTest(unittest.TestCase):
class TestIndexes(unittest.TestCase):
def setUp(self):
self.connection = connect(db="mongoenginetest")
self.db = get_db()

View File

@@ -15,13 +15,11 @@ from mongoengine import (
StringField,
)
from mongoengine.pymongo_support import list_collection_names
from tests.utils import MongoDBTestCase
from tests.fixtures import Base
__all__ = ("InheritanceTest",)
from tests.utils import MongoDBTestCase
class InheritanceTest(MongoDBTestCase):
class TestInheritance(MongoDBTestCase):
def tearDown(self):
for collection in list_collection_names(self.db):
self.db.drop_collection(collection)
@@ -401,7 +399,7 @@ class InheritanceTest(MongoDBTestCase):
class Animal(FinalDocument):
name = StringField()
with self.assertRaises(ValueError) as cm:
with self.assertRaises(ValueError):
class Mammal(Animal):
pass

View File

@@ -39,10 +39,8 @@ from tests.utils import MongoDBTestCase, get_as_pymongo
TEST_IMAGE_PATH = os.path.join(os.path.dirname(__file__), "../fields/mongoengine.png")
__all__ = ("InstanceTest",)
class InstanceTest(MongoDBTestCase):
class TestInstance(MongoDBTestCase):
def setUp(self):
class Job(EmbeddedDocument):
name = StringField()

View File

@@ -1,21 +1,14 @@
import unittest
import uuid
from nose.plugins.skip import SkipTest
from datetime import datetime
from bson import ObjectId
import pymongo
from mongoengine import *
__all__ = ("TestJson",)
from tests.utils import MongoDBTestCase
class TestJson(unittest.TestCase):
def setUp(self):
connect(db="mongoenginetest")
class TestJson(MongoDBTestCase):
def test_json_names(self):
"""
Going to test reported issue:

View File

@@ -3,14 +3,10 @@ import unittest
from datetime import datetime
from mongoengine import *
__all__ = ("ValidatorErrorTest",)
from tests.utils import MongoDBTestCase
class ValidatorErrorTest(unittest.TestCase):
def setUp(self):
connect(db="mongoenginetest")
class TestValidatorError(MongoDBTestCase):
def test_to_dict(self):
"""Ensure a ValidationError handles error to_dict correctly.
"""