[2.2.x] Fixed #30184 -- Removed ellipsis characters from shell output strings.
Partially reverted50b8493581
(refs #29654) to avoid a crash when the user shell doesn't support non-ASCII characters. Backport of2bd8df243a
from master.
This commit is contained in:
parent
f2b460231d
commit
5e94c817ee
|
@ -594,7 +594,7 @@ class LayerMapping:
|
||||||
|
|
||||||
# Printing progress information, if requested.
|
# Printing progress information, if requested.
|
||||||
if progress and num_feat % progress_interval == 0:
|
if progress and num_feat % progress_interval == 0:
|
||||||
stream.write('Processed %d features, saved %d …\n' % (num_feat, num_saved))
|
stream.write('Processed %d features, saved %d ...\n' % (num_feat, num_saved))
|
||||||
|
|
||||||
# Only used for status output purposes -- incremental saving uses the
|
# Only used for status output purposes -- incremental saving uses the
|
||||||
# values returned here.
|
# values returned here.
|
||||||
|
|
|
@ -226,7 +226,7 @@ class Command(BaseCommand):
|
||||||
ser_fmts = serializers.get_public_serializer_formats() if ser_fmt is None else [ser_fmt]
|
ser_fmts = serializers.get_public_serializer_formats() if ser_fmt is None else [ser_fmt]
|
||||||
|
|
||||||
if self.verbosity >= 2:
|
if self.verbosity >= 2:
|
||||||
self.stdout.write("Loading '%s' fixtures…" % fixture_name)
|
self.stdout.write("Loading '%s' fixtures..." % fixture_name)
|
||||||
|
|
||||||
if os.path.isabs(fixture_name):
|
if os.path.isabs(fixture_name):
|
||||||
fixture_dirs = [os.path.dirname(fixture_name)]
|
fixture_dirs = [os.path.dirname(fixture_name)]
|
||||||
|
@ -247,7 +247,7 @@ class Command(BaseCommand):
|
||||||
fixture_files = []
|
fixture_files = []
|
||||||
for fixture_dir in fixture_dirs:
|
for fixture_dir in fixture_dirs:
|
||||||
if self.verbosity >= 2:
|
if self.verbosity >= 2:
|
||||||
self.stdout.write("Checking %s for fixtures…" % humanize(fixture_dir))
|
self.stdout.write("Checking %s for fixtures..." % humanize(fixture_dir))
|
||||||
fixture_files_in_dir = []
|
fixture_files_in_dir = []
|
||||||
path = os.path.join(fixture_dir, fixture_name)
|
path = os.path.join(fixture_dir, fixture_name)
|
||||||
for candidate in glob.iglob(glob.escape(path) + '*'):
|
for candidate in glob.iglob(glob.escape(path) + '*'):
|
||||||
|
|
|
@ -263,7 +263,7 @@ class Command(BaseCommand):
|
||||||
if action == "apply_start":
|
if action == "apply_start":
|
||||||
if compute_time:
|
if compute_time:
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
self.stdout.write(" Applying %s…" % migration, ending="")
|
self.stdout.write(" Applying %s..." % migration, ending="")
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
elif action == "apply_success":
|
elif action == "apply_success":
|
||||||
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
||||||
|
@ -274,7 +274,7 @@ class Command(BaseCommand):
|
||||||
elif action == "unapply_start":
|
elif action == "unapply_start":
|
||||||
if compute_time:
|
if compute_time:
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
self.stdout.write(" Unapplying %s…" % migration, ending="")
|
self.stdout.write(" Unapplying %s..." % migration, ending="")
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
elif action == "unapply_success":
|
elif action == "unapply_success":
|
||||||
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
||||||
|
@ -285,7 +285,7 @@ class Command(BaseCommand):
|
||||||
elif action == "render_start":
|
elif action == "render_start":
|
||||||
if compute_time:
|
if compute_time:
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
self.stdout.write(" Rendering model states…", ending="")
|
self.stdout.write(" Rendering model states...", ending="")
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
elif action == "render_success":
|
elif action == "render_success":
|
||||||
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
elapsed = " (%.3fs)" % (time.time() - self.start) if compute_time else ""
|
||||||
|
@ -321,7 +321,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
# Create the tables for each model
|
# Create the tables for each model
|
||||||
if self.verbosity >= 1:
|
if self.verbosity >= 1:
|
||||||
self.stdout.write(" Creating tables…\n")
|
self.stdout.write(" Creating tables...\n")
|
||||||
with connection.schema_editor() as editor:
|
with connection.schema_editor() as editor:
|
||||||
for app_name, model_list in manifest.items():
|
for app_name, model_list in manifest.items():
|
||||||
for model in model_list:
|
for model in model_list:
|
||||||
|
@ -338,7 +338,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
# Deferred SQL is executed when exiting the editor's context.
|
# Deferred SQL is executed when exiting the editor's context.
|
||||||
if self.verbosity >= 1:
|
if self.verbosity >= 1:
|
||||||
self.stdout.write(" Running deferred SQL…\n")
|
self.stdout.write(" Running deferred SQL...\n")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def describe_operation(operation, backwards):
|
def describe_operation(operation, backwards):
|
||||||
|
|
|
@ -113,7 +113,7 @@ class Command(BaseCommand):
|
||||||
shutdown_message = options.get('shutdown_message', '')
|
shutdown_message = options.get('shutdown_message', '')
|
||||||
quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C'
|
quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C'
|
||||||
|
|
||||||
self.stdout.write("Performing system checks…\n\n")
|
self.stdout.write("Performing system checks...\n\n")
|
||||||
self.check(display_num_errors=True)
|
self.check(display_num_errors=True)
|
||||||
# Need to check migrations here, so can't use the
|
# Need to check migrations here, so can't use the
|
||||||
# requires_migrations_check attribute.
|
# requires_migrations_check attribute.
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Command(BaseCommand):
|
||||||
for parent in sorted(node.parents):
|
for parent in sorted(node.parents):
|
||||||
out.append("%s.%s" % parent.key)
|
out.append("%s.%s" % parent.key)
|
||||||
if out:
|
if out:
|
||||||
return " … (%s)" % ", ".join(out)
|
return " ... (%s)" % ", ".join(out)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
for node in plan:
|
for node in plan:
|
||||||
|
|
|
@ -139,7 +139,7 @@ class Command(BaseCommand):
|
||||||
new_operations = operations
|
new_operations = operations
|
||||||
else:
|
else:
|
||||||
if self.verbosity > 0:
|
if self.verbosity > 0:
|
||||||
self.stdout.write(self.style.MIGRATE_HEADING("Optimizing…"))
|
self.stdout.write(self.style.MIGRATE_HEADING("Optimizing..."))
|
||||||
|
|
||||||
optimizer = MigrationOptimizer()
|
optimizer = MigrationOptimizer()
|
||||||
new_operations = optimizer.optimize(operations, migration.app_label)
|
new_operations = optimizer.optimize(operations, migration.app_label)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BaseDatabaseCreation:
|
||||||
if keepdb:
|
if keepdb:
|
||||||
action = "Using existing"
|
action = "Using existing"
|
||||||
|
|
||||||
self.log('%s test database for alias %s…' % (
|
self.log('%s test database for alias %s...' % (
|
||||||
action,
|
action,
|
||||||
self._get_database_display_str(verbosity, test_database_name),
|
self._get_database_display_str(verbosity, test_database_name),
|
||||||
))
|
))
|
||||||
|
@ -182,7 +182,7 @@ class BaseDatabaseCreation:
|
||||||
if autoclobber or confirm == 'yes':
|
if autoclobber or confirm == 'yes':
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test database for alias %s…' % (
|
self.log('Destroying old test database for alias %s...' % (
|
||||||
self._get_database_display_str(verbosity, test_database_name),
|
self._get_database_display_str(verbosity, test_database_name),
|
||||||
))
|
))
|
||||||
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
||||||
|
@ -206,7 +206,7 @@ class BaseDatabaseCreation:
|
||||||
action = 'Cloning test database'
|
action = 'Cloning test database'
|
||||||
if keepdb:
|
if keepdb:
|
||||||
action = 'Using existing clone'
|
action = 'Using existing clone'
|
||||||
self.log('%s for alias %s…' % (
|
self.log('%s for alias %s...' % (
|
||||||
action,
|
action,
|
||||||
self._get_database_display_str(verbosity, source_database_name),
|
self._get_database_display_str(verbosity, source_database_name),
|
||||||
))
|
))
|
||||||
|
@ -248,7 +248,7 @@ class BaseDatabaseCreation:
|
||||||
action = 'Destroying'
|
action = 'Destroying'
|
||||||
if keepdb:
|
if keepdb:
|
||||||
action = 'Preserving'
|
action = 'Preserving'
|
||||||
self.log('%s test database for alias %s…' % (
|
self.log('%s test database for alias %s...' % (
|
||||||
action,
|
action,
|
||||||
self._get_database_display_str(verbosity, test_database_name),
|
self._get_database_display_str(verbosity, test_database_name),
|
||||||
))
|
))
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test database for alias %s…' % (
|
self.log('Destroying old test database for alias %s...' % (
|
||||||
self._get_database_display_str(verbosity, target_database_name),
|
self._get_database_display_str(verbosity, target_database_name),
|
||||||
))
|
))
|
||||||
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
"Type 'yes' to delete it, or 'no' to cancel: " % parameters['user'])
|
"Type 'yes' to delete it, or 'no' to cancel: " % parameters['user'])
|
||||||
if autoclobber or confirm == 'yes':
|
if autoclobber or confirm == 'yes':
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log("Destroying old test database for alias '%s'…" % self.connection.alias)
|
self.log("Destroying old test database for alias '%s'..." % self.connection.alias)
|
||||||
try:
|
try:
|
||||||
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
||||||
except DatabaseError as e:
|
except DatabaseError as e:
|
||||||
|
@ -69,7 +69,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
|
|
||||||
if self._test_user_create():
|
if self._test_user_create():
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Creating test user…')
|
self.log('Creating test user...')
|
||||||
try:
|
try:
|
||||||
self._create_test_user(cursor, parameters, verbosity, keepdb)
|
self._create_test_user(cursor, parameters, verbosity, keepdb)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -84,10 +84,10 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
if autoclobber or confirm == 'yes':
|
if autoclobber or confirm == 'yes':
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test user…')
|
self.log('Destroying old test user...')
|
||||||
self._destroy_test_user(cursor, parameters, verbosity)
|
self._destroy_test_user(cursor, parameters, verbosity)
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Creating test user…')
|
self.log('Creating test user...')
|
||||||
self._create_test_user(cursor, parameters, verbosity, keepdb)
|
self._create_test_user(cursor, parameters, verbosity, keepdb)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log('Got an error recreating the test user: %s' % e)
|
self.log('Got an error recreating the test user: %s' % e)
|
||||||
|
@ -143,14 +143,14 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
if autoclobber or confirm == 'yes':
|
if autoclobber or confirm == 'yes':
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test user…')
|
self.log('Destroying old test user...')
|
||||||
self._destroy_test_user(cursor, parameters, verbosity)
|
self._destroy_test_user(cursor, parameters, verbosity)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log('Got an error destroying the test user: %s' % e)
|
self.log('Got an error destroying the test user: %s' % e)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log("Destroying old test database for alias '%s'…" % self.connection.alias)
|
self.log("Destroying old test database for alias '%s'..." % self.connection.alias)
|
||||||
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log('Got an error destroying the test database: %s' % e)
|
self.log('Got an error destroying the test database: %s' % e)
|
||||||
|
@ -176,11 +176,11 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
with self._maindb_connection.cursor() as cursor:
|
with self._maindb_connection.cursor() as cursor:
|
||||||
if self._test_user_create():
|
if self._test_user_create():
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying test user…')
|
self.log('Destroying test user...')
|
||||||
self._destroy_test_user(cursor, parameters, verbosity)
|
self._destroy_test_user(cursor, parameters, verbosity)
|
||||||
if self._test_database_create():
|
if self._test_database_create():
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying test database tables…')
|
self.log('Destroying test database tables...')
|
||||||
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
self._execute_test_db_destruction(cursor, parameters, verbosity)
|
||||||
self._maindb_connection.close()
|
self._maindb_connection.close()
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
def _destroy_test_user(self, cursor, parameters, verbosity):
|
def _destroy_test_user(self, cursor, parameters, verbosity):
|
||||||
if verbosity >= 2:
|
if verbosity >= 2:
|
||||||
self.log('_destroy_test_user(): user=%s' % parameters['user'])
|
self.log('_destroy_test_user(): user=%s' % parameters['user'])
|
||||||
self.log('Be patient. This can take some time…')
|
self.log('Be patient. This can take some time...')
|
||||||
statements = [
|
statements = [
|
||||||
'DROP USER %(user)s CASCADE',
|
'DROP USER %(user)s CASCADE',
|
||||||
]
|
]
|
||||||
|
|
|
@ -67,7 +67,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test database for alias %s…' % (
|
self.log('Destroying old test database for alias %s...' % (
|
||||||
self._get_database_display_str(verbosity, target_database_name),
|
self._get_database_display_str(verbosity, target_database_name),
|
||||||
))
|
))
|
||||||
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
cursor.execute('DROP DATABASE %(dbname)s' % test_db_params)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
if not self.is_in_memory_db(test_database_name):
|
if not self.is_in_memory_db(test_database_name):
|
||||||
# Erase the old test database
|
# Erase the old test database
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test database for alias %s…' % (
|
self.log('Destroying old test database for alias %s...' % (
|
||||||
self._get_database_display_str(verbosity, test_database_name),
|
self._get_database_display_str(verbosity, test_database_name),
|
||||||
))
|
))
|
||||||
if os.access(test_database_name, os.F_OK):
|
if os.access(test_database_name, os.F_OK):
|
||||||
|
@ -64,7 +64,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
if keepdb:
|
if keepdb:
|
||||||
return
|
return
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
self.log('Destroying old test database for alias %s…' % (
|
self.log('Destroying old test database for alias %s...' % (
|
||||||
self._get_database_display_str(verbosity, target_database_name),
|
self._get_database_display_str(verbosity, target_database_name),
|
||||||
))
|
))
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -249,7 +249,7 @@ class QuerySet:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
data = list(self[:REPR_OUTPUT_SIZE + 1])
|
data = list(self[:REPR_OUTPUT_SIZE + 1])
|
||||||
if len(data) > REPR_OUTPUT_SIZE:
|
if len(data) > REPR_OUTPUT_SIZE:
|
||||||
data[-1] = "…(remaining elements truncated)…"
|
data[-1] = "...(remaining elements truncated)..."
|
||||||
return '<%s %r>' % (self.__class__.__name__, data)
|
return '<%s %r>' % (self.__class__.__name__, data)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
|
@ -614,7 +614,7 @@ class Query:
|
||||||
# really make sense (or return consistent value sets). Not worth
|
# really make sense (or return consistent value sets). Not worth
|
||||||
# the extra complexity when you can write a real query instead.
|
# the extra complexity when you can write a real query instead.
|
||||||
if self._extra and rhs._extra:
|
if self._extra and rhs._extra:
|
||||||
raise ValueError("When merging querysets using 'or', you cannot have extra(select=…) on both sides.")
|
raise ValueError("When merging querysets using 'or', you cannot have extra(select=...) on both sides.")
|
||||||
self.extra.update(rhs.extra)
|
self.extra.update(rhs.extra)
|
||||||
extra_select_mask = set()
|
extra_select_mask = set()
|
||||||
if self.extra_select_mask is not None:
|
if self.extra_select_mask is not None:
|
||||||
|
|
|
@ -131,7 +131,7 @@ You'll see the following output on the command line:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
Performing system checks…
|
Performing system checks...
|
||||||
|
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
|
|
||||||
|
|
|
@ -338,8 +338,8 @@ Now, run :djadmin:`migrate` again to create those model tables in your database:
|
||||||
Operations to perform:
|
Operations to perform:
|
||||||
Apply all migrations: admin, auth, contenttypes, polls, sessions
|
Apply all migrations: admin, auth, contenttypes, polls, sessions
|
||||||
Running migrations:
|
Running migrations:
|
||||||
Rendering model states… DONE
|
Rendering model states... DONE
|
||||||
Applying polls.0001_initial… OK
|
Applying polls.0001_initial... OK
|
||||||
|
|
||||||
The :djadmin:`migrate` command takes all the migrations that haven't been
|
The :djadmin:`migrate` command takes all the migrations that haven't been
|
||||||
applied (Django tracks which ones are applied using a special table in your
|
applied (Django tracks which ones are applied using a special table in your
|
||||||
|
|
|
@ -203,7 +203,7 @@ In the terminal, we can run our test:
|
||||||
|
|
||||||
and you'll see something like::
|
and you'll see something like::
|
||||||
|
|
||||||
Creating test database for alias 'default'…
|
Creating test database for alias 'default'...
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
F
|
F
|
||||||
======================================================================
|
======================================================================
|
||||||
|
@ -218,7 +218,7 @@ and you'll see something like::
|
||||||
Ran 1 test in 0.001s
|
Ran 1 test in 0.001s
|
||||||
|
|
||||||
FAILED (failures=1)
|
FAILED (failures=1)
|
||||||
Destroying test database for alias 'default'…
|
Destroying test database for alias 'default'...
|
||||||
|
|
||||||
What happened is this:
|
What happened is this:
|
||||||
|
|
||||||
|
@ -257,14 +257,14 @@ past:
|
||||||
|
|
||||||
and run the test again::
|
and run the test again::
|
||||||
|
|
||||||
Creating test database for alias 'default'…
|
Creating test database for alias 'default'...
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
.
|
.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 1 test in 0.001s
|
Ran 1 test in 0.001s
|
||||||
|
|
||||||
OK
|
OK
|
||||||
Destroying test database for alias 'default'…
|
Destroying test database for alias 'default'...
|
||||||
|
|
||||||
After identifying a bug, we wrote a test that exposes it and corrected the bug
|
After identifying a bug, we wrote a test that exposes it and corrected the bug
|
||||||
in the code so our test passes.
|
in the code so our test passes.
|
||||||
|
|
|
@ -135,8 +135,8 @@ database to make sure they work as expected::
|
||||||
Operations to perform:
|
Operations to perform:
|
||||||
Apply all migrations: books
|
Apply all migrations: books
|
||||||
Running migrations:
|
Running migrations:
|
||||||
Rendering model states… DONE
|
Rendering model states... DONE
|
||||||
Applying books.0003_auto… OK
|
Applying books.0003_auto... OK
|
||||||
|
|
||||||
Once the migration is applied, commit the migration and the models change
|
Once the migration is applied, commit the migration and the models change
|
||||||
to your version control system as a single commit - that way, when other
|
to your version control system as a single commit - that way, when other
|
||||||
|
|
|
@ -279,7 +279,7 @@ When you run your tests, you'll see a number of messages as the test runner
|
||||||
prepares itself. You can control the level of detail of these messages with the
|
prepares itself. You can control the level of detail of these messages with the
|
||||||
``verbosity`` option on the command line::
|
``verbosity`` option on the command line::
|
||||||
|
|
||||||
Creating test database…
|
Creating test database...
|
||||||
Creating table myapp_animal
|
Creating table myapp_animal
|
||||||
Creating table myapp_mineral
|
Creating table myapp_mineral
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command('migrate', 'migrations', '0001', verbosity=1, stdout=stdout, no_color=True)
|
call_command('migrate', 'migrations', '0001', verbosity=1, stdout=stdout, no_color=True)
|
||||||
stdout = stdout.getvalue()
|
stdout = stdout.getvalue()
|
||||||
self.assertIn('Target specific migration: 0001_initial, from migrations', stdout)
|
self.assertIn('Target specific migration: 0001_initial, from migrations', stdout)
|
||||||
self.assertIn('Applying migrations.0001_initial… OK', stdout)
|
self.assertIn('Applying migrations.0001_initial... OK', stdout)
|
||||||
# The correct tables exist
|
# The correct tables exist
|
||||||
self.assertTableExists("migrations_author")
|
self.assertTableExists("migrations_author")
|
||||||
self.assertTableExists("migrations_tribble")
|
self.assertTableExists("migrations_tribble")
|
||||||
|
@ -57,7 +57,7 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command('migrate', 'migrations', 'zero', verbosity=1, stdout=stdout, no_color=True)
|
call_command('migrate', 'migrations', 'zero', verbosity=1, stdout=stdout, no_color=True)
|
||||||
stdout = stdout.getvalue()
|
stdout = stdout.getvalue()
|
||||||
self.assertIn('Unapply all migrations: migrations', stdout)
|
self.assertIn('Unapply all migrations: migrations', stdout)
|
||||||
self.assertIn('Unapplying migrations.0002_second… OK', stdout)
|
self.assertIn('Unapplying migrations.0002_second... OK', stdout)
|
||||||
# Tables are gone
|
# Tables are gone
|
||||||
self.assertTableNotExists("migrations_author")
|
self.assertTableNotExists("migrations_author")
|
||||||
self.assertTableNotExists("migrations_tribble")
|
self.assertTableNotExists("migrations_tribble")
|
||||||
|
@ -157,7 +157,7 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command("migrate", "migrations", "0001", fake_initial=True, stdout=out, verbosity=1)
|
call_command("migrate", "migrations", "0001", fake_initial=True, stdout=out, verbosity=1)
|
||||||
call_command("migrate", "migrations", "0001", fake_initial=True, verbosity=0, database="other")
|
call_command("migrate", "migrations", "0001", fake_initial=True, verbosity=0, database="other")
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"migrations.0001_initial… faked",
|
"migrations.0001_initial... faked",
|
||||||
out.getvalue().lower()
|
out.getvalue().lower()
|
||||||
)
|
)
|
||||||
# Run migrations all the way
|
# Run migrations all the way
|
||||||
|
@ -208,8 +208,8 @@ class MigrateTests(MigrationTestBase):
|
||||||
with mock.patch('django.core.management.color.supports_color', lambda *args: False):
|
with mock.patch('django.core.management.color.supports_color', lambda *args: False):
|
||||||
call_command("migrate", "migrations", "0002", fake_initial=True, stdout=out, verbosity=1)
|
call_command("migrate", "migrations", "0002", fake_initial=True, stdout=out, verbosity=1)
|
||||||
value = out.getvalue().lower()
|
value = out.getvalue().lower()
|
||||||
self.assertIn("migrations.0001_initial… faked", value)
|
self.assertIn("migrations.0001_initial... faked", value)
|
||||||
self.assertIn("migrations.0002_second… faked", value)
|
self.assertIn("migrations.0002_second... faked", value)
|
||||||
# Fake an apply
|
# Fake an apply
|
||||||
call_command("migrate", "migrations", fake=True, verbosity=0)
|
call_command("migrate", "migrations", fake=True, verbosity=0)
|
||||||
# Unmigrate everything
|
# Unmigrate everything
|
||||||
|
@ -271,8 +271,8 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
"[ ] migrations.0001_initial\n"
|
"[ ] migrations.0001_initial\n"
|
||||||
"[ ] migrations.0003_third … (migrations.0001_initial)\n"
|
"[ ] migrations.0003_third ... (migrations.0001_initial)\n"
|
||||||
"[ ] migrations.0002_second … (migrations.0001_initial, migrations.0003_third)\n",
|
"[ ] migrations.0002_second ... (migrations.0001_initial, migrations.0003_third)\n",
|
||||||
out.getvalue().lower()
|
out.getvalue().lower()
|
||||||
)
|
)
|
||||||
call_command("migrate", "migrations", "0003", verbosity=0)
|
call_command("migrate", "migrations", "0003", verbosity=0)
|
||||||
|
@ -290,8 +290,8 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
"[x] migrations.0001_initial\n"
|
"[x] migrations.0001_initial\n"
|
||||||
"[x] migrations.0003_third … (migrations.0001_initial)\n"
|
"[x] migrations.0003_third ... (migrations.0001_initial)\n"
|
||||||
"[ ] migrations.0002_second … (migrations.0001_initial, migrations.0003_third)\n",
|
"[ ] migrations.0002_second ... (migrations.0001_initial, migrations.0003_third)\n",
|
||||||
out.getvalue().lower()
|
out.getvalue().lower()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -410,10 +410,10 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
"[ ] migrations.1_auto\n"
|
"[ ] migrations.1_auto\n"
|
||||||
"[ ] migrations.2_auto … (migrations.1_auto)\n"
|
"[ ] migrations.2_auto ... (migrations.1_auto)\n"
|
||||||
"[ ] migrations.3_squashed_5 … (migrations.2_auto)\n"
|
"[ ] migrations.3_squashed_5 ... (migrations.2_auto)\n"
|
||||||
"[ ] migrations.6_auto … (migrations.3_squashed_5)\n"
|
"[ ] migrations.6_auto ... (migrations.3_squashed_5)\n"
|
||||||
"[ ] migrations.7_auto … (migrations.6_auto)\n",
|
"[ ] migrations.7_auto ... (migrations.6_auto)\n",
|
||||||
out.getvalue().lower()
|
out.getvalue().lower()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -434,10 +434,10 @@ class MigrateTests(MigrationTestBase):
|
||||||
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
call_command("showmigrations", format='plan', stdout=out, verbosity=2)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
"[x] migrations.1_auto\n"
|
"[x] migrations.1_auto\n"
|
||||||
"[x] migrations.2_auto … (migrations.1_auto)\n"
|
"[x] migrations.2_auto ... (migrations.1_auto)\n"
|
||||||
"[x] migrations.3_squashed_5 … (migrations.2_auto)\n"
|
"[x] migrations.3_squashed_5 ... (migrations.2_auto)\n"
|
||||||
"[ ] migrations.6_auto … (migrations.3_squashed_5)\n"
|
"[ ] migrations.6_auto ... (migrations.3_squashed_5)\n"
|
||||||
"[ ] migrations.7_auto … (migrations.6_auto)\n",
|
"[ ] migrations.7_auto ... (migrations.6_auto)\n",
|
||||||
out.getvalue().lower()
|
out.getvalue().lower()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ class MigrateTests(MigrationTestBase):
|
||||||
self.assertGreater(len(execute.mock_calls), 2)
|
self.assertGreater(len(execute.mock_calls), 2)
|
||||||
stdout = stdout.getvalue()
|
stdout = stdout.getvalue()
|
||||||
self.assertIn('Synchronize unmigrated apps: unmigrated_app_syncdb', stdout)
|
self.assertIn('Synchronize unmigrated apps: unmigrated_app_syncdb', stdout)
|
||||||
self.assertIn('Creating tables…', stdout)
|
self.assertIn('Creating tables...', stdout)
|
||||||
table_name = truncate_name('unmigrated_app_syncdb_classroom', connection.ops.max_name_length())
|
table_name = truncate_name('unmigrated_app_syncdb_classroom', connection.ops.max_name_length())
|
||||||
self.assertIn('Creating table %s' % table_name, stdout)
|
self.assertIn('Creating table %s' % table_name, stdout)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue