remove references to nose

This commit is contained in:
Bastien Gérard
2019-09-01 15:27:11 +03:00
parent bc0c55e49a
commit 799cdafae6
10 changed files with 37 additions and 61 deletions

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import sys
from unittest import SkipTest
import pytest
@@ -46,11 +45,6 @@ class TestEmailField(MongoDBTestCase):
user.validate()
def test_email_field_unicode_user(self):
# Don't run this test on pypy3, which doesn't support unicode regex:
# https://bitbucket.org/pypy/pypy/issues/1821/regular-expression-doesnt-find-unicode
if sys.version_info[:2] == (3, 2):
raise SkipTest("unicode email addresses are not supported on PyPy 3")
class User(Document):
email = EmailField()

View File

@@ -3,7 +3,6 @@ import datetime
import unittest
from bson import DBRef, ObjectId, SON
from nose.plugins.skip import SkipTest
import pytest
from mongoengine import (
@@ -1239,17 +1238,17 @@ class TestField(MongoDBTestCase):
a = A._from_son(SON([("fb", SON([("fc", SON([("txt", "hi")]))]))]))
assert a.b.c.txt == "hi"
@pytest.mark.xfail(
reason="Using a string reference in an EmbeddedDocumentField does not work if the class isnt registerd yet",
raises=NotRegistered,
)
def test_embedded_document_field_cant_reference_using_a_str_if_it_does_not_exist_yet(
self,
):
raise SkipTest(
"Using a string reference in an EmbeddedDocumentField does not work if the class isnt registerd yet"
)
class MyDoc2(Document):
emb = EmbeddedDocumentField("MyDoc")
emb = EmbeddedDocumentField("MyFunkyDoc123")
class MyDoc(EmbeddedDocument):
class MyFunkyDoc123(EmbeddedDocument):
name = StringField()
def test_embedded_document_validation(self):

View File

@@ -5,7 +5,7 @@ import tempfile
import unittest
import gridfs
from nose.plugins.skip import SkipTest
import pytest
import six
from mongoengine import *
@@ -21,6 +21,8 @@ except ImportError:
from tests.utils import MongoDBTestCase
require_pil = pytest.mark.skipif(not HAS_PIL, reason="PIL not installed")
TEST_IMAGE_PATH = os.path.join(os.path.dirname(__file__), "mongoengine.png")
TEST_IMAGE2_PATH = os.path.join(os.path.dirname(__file__), "mongodb_leaf.png")
@@ -377,10 +379,8 @@ class TestFileField(MongoDBTestCase):
assert len(list(files)) == 0
assert len(list(chunks)) == 0
@require_pil
def test_image_field(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestImage(Document):
image = ImageField()
@@ -411,10 +411,8 @@ class TestFileField(MongoDBTestCase):
t.image.delete()
@require_pil
def test_image_field_reassigning(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestFile(Document):
the_file = ImageField()
@@ -428,10 +426,8 @@ class TestFileField(MongoDBTestCase):
test_file.save()
assert test_file.the_file.size == (45, 101)
@require_pil
def test_image_field_resize(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestImage(Document):
image = ImageField(size=(185, 37))
@@ -451,10 +447,8 @@ class TestFileField(MongoDBTestCase):
t.image.delete()
@require_pil
def test_image_field_resize_force(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestImage(Document):
image = ImageField(size=(185, 37, True))
@@ -474,10 +468,8 @@ class TestFileField(MongoDBTestCase):
t.image.delete()
@require_pil
def test_image_field_thumbnail(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestImage(Document):
image = ImageField(thumbnail_size=(92, 18))
@@ -546,11 +538,8 @@ class TestFileField(MongoDBTestCase):
assert putfile == copy.copy(putfile)
assert putfile == copy.deepcopy(putfile)
@require_pil
def test_get_image_by_grid_id(self):
if not HAS_PIL:
raise SkipTest("PIL not installed")
class TestImage(Document):
image1 = ImageField()