Code

#20214 closed Uncategorized (needsinfo)

Custom User Model Manager has problem with test database

Reported by: dnielfs@… Owned by: nobody
Component: Testing framework Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm using a custom user model with :

class BaseUser(AbstractUser) and AUTH_USER_MODEL = "main.BaseUser" .

But when I try to run the test cases I got this error :

(DEV)devniel@ubuntu:~/xxx$ python manage.py test main
Creating test database for alias 'default'...
Got an error creating the test database: (1007, "Can't create database 'test_xxx'; database exists")
Type 'yes' if you would like to try deleting the test database 'test_quickytaxi', or 'no' to cancel: yes
Destroying old test database 'default'...
AttributeError: Manager isn't available; User has been swapped for 'main.BaseUser'

I try with a test.py empty and the problem still persists.

Attachments (0)

Change History (1)

comment:1 Changed 13 months ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

I can't reproduce this - I've got several test projects plus projects in production that are using custom user models, and they're not having the problem you describe.

Two things would be helpful here:

1) The output of ./manage.py test --traceback. This will give us the full error (and the stack trace)

2) A description of the minimum steps you need to follow to reproduce this problem. My first guess is that you've got some sort of signal handling going on here; but it's impossible to say without seeing code.

Closing needsinfo -- we haven't got enough information to reproduce this problem. Please reopen if you can provide the information I've described.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.