On Sun, 2008-03-23 at 11:15 -0400, Ned Batchelder wrote:
[...]
> Here's one of the tests in question:
>
> >>> f = forms.FilePathField(path=path)
> >>> f.choices.sort()
> >>> f.choices
> [('.../django/newforms/__init__.py', '__init__.py'),
> ('.../django/newforms/__init__.pyc', '__init__.pyc'),
> ('.../django/newforms/fields.py', 'fields.py'),
> ('.../django/newforms/fields.pyc', 'fields.pyc'),
> ('.../django/newforms/forms.py', 'forms.py'),
> ('.../django/newforms/forms.pyc', 'forms.pyc'),
> ('.../django/newforms/models.py', 'models.py'),
> ('.../django/newforms/models.pyc', 'models.pyc'),
> ('.../django/newforms/util.py', 'util.py'),
> ('.../django/newforms/util.pyc', 'util.pyc'),
> ('.../django/newforms/widgets.py', 'widgets.py'),
> ('.../django/newforms/widgets.pyc', 'widgets.pyc')]
>
> On my machine, the problem boils down to:
>
> Expected: '.../django/newforms/__init__.py'
> Got: 'C:\\src\\django\\django\\newforms/__init__.py'
[...]
>
> Any guidance?
Given that we can compute the expect result pretty easily (it's the
directory listing of the that directory), I'd be tempted to compute the
expected result as part of the test and compare it to what the widget
puts out. This isn't quite as tight a coupling as it looks on the
surface, since the interface definition is that it returns a list of
tuples that are the files in that path. So we can write the "expected
result" based on the interface description, not the implementation (yes,
it's semantic hair-splitting, but it's type of trickery that helps me
sleep at nights in those months when I sleep).
I'm always a little wary of the "just add more dots" approach to ironing
out these problems because unexpected test failures have caught a lot of
problems over the past couple of years.
Still, adding more leading dots wouldn't destroy the world order,
either.
Regards,
Malcolm
--
Why be difficult when, with a little bit of effort, you could be
impossible.
http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---