revsys / django-test-plus

Useful additions to Django's default TestCase

Home Page:https://django-test-plus.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import curry Error when user TestCase

testmtbf10 opened this issue · comments

here is the test code:
`from test_plus.test import TestCase

class TestUser(TestCase):

def setUp(self):
    self.user=self.make_user(username="testuser", password='password')

def test__str__(self):
    self.assertEqual(self.user.__str__(), 'testuser')

def test_get_profile_name(self):
    assert self.user.get_profile_name() == 'testuser'
    self.user.name = '昵称'
    assert self.user.get_profile_name() == '昵称'

def test_get_absolute_url(self):
    assert self.user.get_absolute_url() == f"/users/{self.user.username}/"`

and when run TestUser, Error occurs:

Error
ImportError: Failed to import test module: test_models
Traceback (most recent call last):
File "D:\Python\Python36\lib\unittest\loader.py", line 153, in loadTestsFromName
module = import(module_name)
File "F:\Learn\python_work\Web\mydjango\mydjango\users\tests\test_models.py", line 10, in
from test_plus.test import TestCase
File "F:\Learn\python_work\Web\mydjango\venv\lib\site-packages\test_plus_init_.py", line 1, in
from .test import APITestCase, TestCase
File "F:\Learn\python_work\Web\mydjango\venv\lib\site-packages\test_plus\test.py", line 14, in
from django.utils.functional import curry
ImportError: cannot import name 'curry'

And django-test-plus==1.2.0/pytest==5.4.2/django==3.0.6

Apologies for the delay. Feel free to re-open but this appears to be fixed in #110 and newer versions.