Opened 18 years ago
Closed 18 years ago
#6825 closed (fixed)
Failed tests when runtests.py is run on Windows
| Reported by: | Jason Erickson | Owned by: | Jason Erickson | 
|---|---|---|---|
| Component: | Testing framework | Version: | dev | 
| Severity: | Keywords: | windows, doctest, test | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
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 (1)
Change History (3)
by , 18 years ago
| Attachment: | model-windows-fix.diff added | 
|---|
comment:1 by , 18 years ago
| Owner: | changed from to | 
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin | 
comment:2 by , 18 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Patch to moteltests/models_forms/models.py that removes the / when testing the filenames.