Django

Code

Ticket #6825 (closed: fixed)

Opened 4 months ago

Last modified 4 months ago

Failed tests when runtests.py is run on Windows

Reported by: jerickso Assigned to: jerickso
Milestone: Component: Unit test system
Version: SVN Keywords: windows, doctest, test
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

When runing Django's runtests.py on Windows, modeltests/models_forms/models.py fails:

======================================================================
FAIL: Doctest: modeltests.model_forms.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\prj\djangodev\django\test\_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.model_forms.models.__test__.API_TESTS
  File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.file
Expected:
    u'.../test1.txt'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test1.txt'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    f.cleaned_data['file']
Expected:
    u'.../test1.txt'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test1.txt'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.file
Expected:
    u'.../test1.txt'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test1.txt'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.file
Expected:
    u'.../test2.txt'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test2.txt'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.file
Expected:
    u'.../test3.txt'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test3.txt'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    u'.../test.png'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test.png'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    f.cleaned_data['image']
Expected:
    u'.../test.png'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test.png'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    u'.../test.png'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test.png'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    u'.../test2.png'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test2.png'
----------------------------------------------------------------------
File "C:\prj\djangodev\tests\modeltests\model_forms\models.py", line ?, in modeltests.model_forms.models.__test__.API_TESTS
Failed example:
    instance.image
Expected:
    u'.../test3.png'
Got:
    u'c:\\users\\owner\\appdata\\local\\temp\\test3.png'


----------------------------------------------------------------------

These tests fail because of comparing a forward slash before the file name with the doctest in modeltests/model/forms/models.py, where windows uses the backslash as a separator for directories and files. The attached patch changes the doctest to not compare the slash at the beginning of the filename to allow it to pass on windows.

Attachments

model-windows-fix.diff (1.9 kB) - added by jerickso on 03/18/08 19:08:39.
Patch to moteltests/models_forms/models.py that removes the / when testing the filenames.

Change History

03/18/08 19:08:39 changed by jerickso

  • attachment model-windows-fix.diff added.

Patch to moteltests/models_forms/models.py that removes the / when testing the filenames.

03/18/08 19:10:09 changed by jerickso

  • owner changed from nobody to jerickso.
  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

03/20/08 02:19:54 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [7335]) Fixed #6825 -- Fixed the model_forms tests to also work on Windows by making the filename detection a lot looser. Thanks, jerickso.


Add/Change #6825 (Failed tests when runtests.py is run on Windows)




Change Properties
Action