mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Refs #23919 -- Replaced io.open() with open().
io.open() is an alias for open() on Python 3.
This commit is contained in:
parent
eb422e476f
commit
a556396339
11 changed files with 30 additions and 40 deletions
|
@ -655,7 +655,7 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||
initial_file = os.path.join(migration_dir, "0001_initial.py")
|
||||
self.assertTrue(os.path.exists(initial_file))
|
||||
|
||||
with io.open(initial_file, 'r', encoding='utf-8') as fp:
|
||||
with open(initial_file, 'r', encoding='utf-8') as fp:
|
||||
content = fp.read()
|
||||
self.assertIn('migrations.CreateModel', content)
|
||||
self.assertIn('initial = True', content)
|
||||
|
@ -798,7 +798,7 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||
initial_file = os.path.join(migration_dir, "0001_initial.py")
|
||||
self.assertTrue(os.path.exists(initial_file))
|
||||
|
||||
with io.open(initial_file, 'r', encoding='utf-8') as fp:
|
||||
with open(initial_file, 'r', encoding='utf-8') as fp:
|
||||
content = fp.read()
|
||||
|
||||
# Remove all whitespace to check for empty dependencies and operations
|
||||
|
@ -1192,7 +1192,7 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||
migration_file = os.path.join(migration_dir, "%s_%s.py" % (migration_count, migration_name))
|
||||
# Check for existing migration file in migration folder
|
||||
self.assertTrue(os.path.exists(migration_file))
|
||||
with io.open(migration_file, "r", encoding="utf-8") as fp:
|
||||
with open(migration_file, "r", encoding="utf-8") as fp:
|
||||
content = fp.read()
|
||||
content = content.replace(" ", "")
|
||||
return content
|
||||
|
@ -1307,7 +1307,7 @@ class SquashMigrationsTests(MigrationTestBase):
|
|||
call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=0)
|
||||
|
||||
squashed_migration_file = os.path.join(migration_dir, "0001_squashed_0002_second.py")
|
||||
with io.open(squashed_migration_file, "r", encoding="utf-8") as fp:
|
||||
with open(squashed_migration_file, "r", encoding="utf-8") as fp:
|
||||
content = fp.read()
|
||||
self.assertIn("initial = True", content)
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ class SquashMigrationsTests(MigrationTestBase):
|
|||
interactive=False, verbosity=1, stdout=out)
|
||||
|
||||
squashed_migration_file = os.path.join(migration_dir, "0002_second_squashed_0003_third.py")
|
||||
with io.open(squashed_migration_file, "r", encoding="utf-8") as fp:
|
||||
with open(squashed_migration_file, "r", encoding="utf-8") as fp:
|
||||
content = fp.read()
|
||||
self.assertIn(" ('migrations', '0001_initial')", content)
|
||||
self.assertNotIn("initial = True", content)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue