Giter VIP home page Giter VIP logo

Comments (9)

gavinwahl avatar gavinwahl commented on June 22, 2024

I get this error:

Traceback (most recent call last):
  File "./manage.py", line 13, in <module>
    from django.contrib.auth.tests import custom_user
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/contrib/auth/tests/custom_user.py", line 2, in <module>
    from django.contrib.auth.models import (
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 16, in <module>
    from django.contrib.contenttypes.models import ContentType
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 140, in <module>
    class ContentType(models.Model):
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/models/base.py", line 105, in __new__
    warnings.warn(msg, RemovedInDjango19Warning, stacklevel=2)
django.utils.deprecation.RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.

This is because our manage.py is importing models (225e89f) before django is set up. I added a django.setup() line in manage.py to see if that would do anything, and now I get this error:

Traceback (most recent call last):
  File "./manage.py", line 19, in <module>
    execute_from_command_line(sys.argv)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 71, in execute
    super(Command, self).execute(*args, **options)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 88, in handle
    failures = test_runner.run_tests(test_labels)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/test/runner.py", line 147, in run_tests
    old_config = self.setup_databases()
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/test/runner.py", line 109, in setup_databases
    return setup_databases(self.verbosity, self.interactive, **kwargs)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/test/runner.py", line 299, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/creation.py", line 385, in create_test_db
    self.connection._test_serialized_contents = self.serialize_db_to_string()
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/creation.py", line 421, in serialize_db_to_string
    serializers.serialize("json", get_objects(), indent=None, stream=out)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/serializers/__init__.py", line 128, in serialize
    s.serialize(queryset, **options)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/core/serializers/base.py", line 52, in serialize
    for obj in queryset:
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/creation.py", line 417, in get_objects
    for obj in queryset.iterator():
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/models/query.py", line 265, in iterator
    for row in compiler.results_iter():
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter
    for rows in self.execute_sql(MULTI):
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
    cursor.execute(sql, params)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File ".virtualenvs/tmp-493b68aa9cd4c227/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: auth_customuser

from django-authtools.

pipermerriam avatar pipermerriam commented on June 22, 2024

Why are those lines there in the first place?

You could potentially sidestep this by creating an app that is only installed during test runs and put that monkepatch code in the models.py file. Then it'll still run during setup.

from django-authtools.

gavinwahl avatar gavinwahl commented on June 22, 2024

They're needed to run the tests on django 1.6. I don't remember exactly why, maybe @rockymeza does.

from django-authtools.

gavinwahl avatar gavinwahl commented on June 22, 2024

It was issue #12

from django-authtools.

rockymeza avatar rockymeza commented on June 22, 2024

I profoundly do not understand what happened in #12.

from django-authtools.

rockymeza avatar rockymeza commented on June 22, 2024

I also get the auth_customuser error and I don't know where it's coming from. I think that maybe it's time we stop relying on the built-in tests.

from django-authtools.

rockymeza avatar rockymeza commented on June 22, 2024

My stuff is in the 1.7-support branch, but I'm stuck on the same error as @gavinwahl was.

from django-authtools.

gavinwahl avatar gavinwahl commented on June 22, 2024

The django.contrib.auth tests have their own models, but where are the migrations? How do those models get created in django's tests? I think that part is just getting skipped when we run the tests.

from django-authtools.

acatton avatar acatton commented on June 22, 2024

@gavinwahl @rockymeza This models get created without migrations in Django tests à la syncdb. I spend 2 hours reading and understanding django's code. I finally found the obvious line. I committed a fix in 1.7-support: 280c5dd .

You can run the tests, but they don't pass. I'm still working on it.

from django-authtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.