#27436: migrations.test_commands.MakeMigrationsTests fail on Windows when run 
on a
different drive than C:
-------------------------------------+-------------------------------------
               Reporter:  Zbigniew   |          Owner:  nobody
  Siciarz                            |
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  master
  (Management commands)              |
               Severity:  Normal     |       Keywords:  tests
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Some of the test cases in MakeMigrationsTests fail on Windows due to
 inability to find a relative path between files located on separate
 drives.
 The tests create a temporary migrations directory using
 `tempfile.mkdtemp`, which on Windows creates a directory under C:\Temp (or
 C:\Users\<username>\AppData\Local\Temp).

 If one clones Django source code to a drive other than C:, then the
 makemigrations command tests fail with an error like the following
 (Windows 7, Python 3.5.1):

 {{{
 ERROR: test_makemigrations_non_interactive_not_null_alteration
 (migrations.test_commands.MakeMigrationsTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\dev\django\tests\migrations\test_commands.py", line 834, in
 test_makemigrations_non_interactive_not_null_alteration
     call_command("makemigrations", "migrations", interactive=False,
 stdout=out)
   File "d:\dev\django\django\core\management\__init__.py", line 130, in
 call_command
     return command.execute(*args, **defaults)
   File "d:\dev\django\django\core\management\base.py", line 330, in
 execute
     output = self.handle(*args, **options)
   File "d:\dev\django\django\core\management\commands\makemigrations.py",
 line 193, in handle
     self.write_migration_files(changes)
   File "d:\dev\django\django\core\management\commands\makemigrations.py",
 line 211, in write_migration_files
     migration_string = os.path.relpath(writer.path)
   File "D:\Miniconda3\lib\ntpath.py", line 574, in relpath
     path_drive, start_drive))
 ValueError: path is on mount 'C:', start on mount 'D:'
 }}}

 Since the value returned from `relpath` is used only for display and not
 for any I/O, I'd suggest catching this `ValueError` and using an absolute
 path in that case.

--
Ticket URL: <https://code.djangoproject.com/ticket/27436>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.1aea790fef47a49d940ddc8f713e537d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to