diff options
| author | Zbigniew Siciarz <zbigniew@siciarz.net> | 2016-11-09 00:06:17 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-11-08 18:06:17 -0500 |
| commit | f94ce0d21de484a5783a3dcb122dc51757ed225b (patch) | |
| tree | 2cd100088ab22d094bd931b2b1a3a6db8ab8c21d /tests | |
| parent | b9eb267c46cac4f20634b57d25a4ccbc115d6892 (diff) | |
Fixed #27436 -- Fixed makemigrations crash when creating migrations on a separate drive than where Django is installed.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_commands.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 6681ceecbc..fb2b0fb877 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -1152,6 +1152,19 @@ class MakeMigrationsTests(MigrationTestBase): call_command("makemigrations", "migrations", stdout=out) self.assertIn(os.path.join(migration_dir, '0001_initial.py'), out.getvalue()) + def test_makemigrations_migration_path_output_valueerror(self): + """ + makemigrations prints the absolute path if os.path.relpath() raises a + ValueError when it's impossible to obtain a relative path, e.g. on + Windows if Django is installed on a different drive than where the + migration files are created. + """ + out = six.StringIO() + with self.temporary_migration_module() as migration_dir: + with mock.patch('os.path.relpath', side_effect=ValueError): + call_command('makemigrations', 'migrations', stdout=out) + self.assertIn(os.path.join(migration_dir, '0001_initial.py'), out.getvalue()) + def test_makemigrations_inconsistent_history(self): """ makemigrations should raise InconsistentMigrationHistory exception if |
