#26198: partition_suite() removing non duplicate tests
-----------------------------------+--------------------------------------
     Reporter:  lukeaus            |                    Owner:  nobody
         Type:  Bug                |                   Status:  closed
    Component:  Testing framework  |                  Version:  1.8
     Severity:  Normal             |               Resolution:  invalid
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Changes (by charettes):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => invalid
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 Hi lukeaus,

 Thanks for your report but it looks like this is bug in `django-behave`.

 Python `set` (and Django's `OrderedSet`) use the `__hash__` method of
 objects that are added to them to identify them uniquely.

 In the case of `unittest.TestCase` instance this method returns the `type`
 of the testcase and the name of the the test method:

 {{{#!python
 def __hash__(self):
     return hash((type(self), self._testMethodName))
 }}}

 It looks like `django-behave` adds multiple instance of
 `DjangoBehaveTestCase` to its suite but all of them have `runTest` as test
 method name resulting in the same `hash()` output and making them
 indistinguishable.

 From a quick look the `DjangoBehaveTestCase.__hash__()` method should be
 adjusted to also include `self.features_dir`:

 {{{#!python
 def __hash__(self):
     return hash((type(self), self._testMethodName, self.features_dir))
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26198#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ec43836e78a0fbc3df94e065e66a616a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to