matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
197 stars 63 forks source link

_discount_admin_state test failure under Django 1.6 #63

Closed DrMeers closed 10 years ago

DrMeers commented 10 years ago

No time to look into it right now, but leaving a note for later. Everything else seems to pass

======================================================================
ERROR: test_01_products (testapp.tests.admin.AdminTest)
Test whether the administration interface is well behaved
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/Data/Repositories/plata/tests/testapp/tests/admin.py", line 81, in test_01_products
    self.assertContains(self.client.post('/admin/discount/discount/add/', discount_data),
...
File "/Volumes/Data/Repositories/plata/plata/discount/admin.py", line 117, in get_fieldsets
    _discount_admin_state._plata_discount_config_fieldsets)
AttributeError: 'thread._local' object has no attribute '_plata_discount_config_fieldsets'
matthiask commented 10 years ago

The modification of fieldsets always was implemented in a hacky way. We should be able to do better by splitting the fieldsets modification code between get_fieldsets and the DiscountAdminForm... I'll try fixing this issue in the next days.

matthiask commented 10 years ago

I'm getting a clean test run with the commit referenced above (Python 2.6 and 2.7, Django 1.4, 1.5 and 1.6).

It still is a gigantic hack.

Comments?

DrMeers commented 10 years ago

Thanks :)

I'm not familiar enough with this part of the codebase to comment at present, having not used Discounts, but will look into it if/when I do ...

matthiask commented 10 years ago

Seems to work fine.