Opened 2 years ago

Closed 2 years ago

#26017 closed Uncategorized (fixed)

forms_tests.tests.test_fields.FieldsTests.test_filepathfield_folders does not work when the tests directory is named differently

Reported by: Raphaël Hertzog Owned by: nobody
Component: Uncategorized Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I tried "cp -a tests ~/tmp/django-tests" and then ran the tests from ~/tmp/django-tests. It turns out you get this failure:

======================================================================
FAIL: test_filepathfield_folders (forms_tests.tests.test_fields.FieldsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rhertzog/tmp/django-tests/forms_tests/tests/test_fields.py", line 1586, in test_filepathfield_folders
    self.assertTrue(got[0].endswith(exp[0]))
AssertionError: False is not true

Printing got and exp before the test you see this:

(u'/home/rhertzog/tmp/django-tests/forms_tests/tests/filepath_test_files/directory', u'directory')
(u'/tests/forms_tests/tests/filepath_test_files/directory', u'directory')

As you can see the difference is in the "/django-tests/" vs "/tests/" that do not match.

I would suggest that tests should not depend on the name of the top-level directory in which they are stored... it's an easy patch and I will submit it soon as PR.

Change History (3)

comment:1 Changed 2 years ago by Raphaël Hertzog

comment:2 Changed 2 years ago by Raphaël Hertzog

Has patch: set

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In e0f3703:

Fixed #26017 -- Removed a dependency on the name of the top-level tests directory.

Note: See TracTickets for help on using tickets.
Back to Top