[PATCH v6 06/10] REST: Add Patches to the API

Finucane, Stephen stephen.finucane at intel.com
Wed Jun 22 01:28:41 AEST 2016


On 21 Jun 10:02, Andy Doan wrote:
> On 06/19/2016 01:19 PM, Finucane, Stephen wrote:
> >On 16 Jun 16:13, Andy Doan wrote:

[snip]

> >This doesn't seem to be storing tags correctly.
> >
> >     ======================================================================
> >     FAIL: test_detail_tags (patchwork.tests.test_rest_api.TestPatchAPI)
> >     ----------------------------------------------------------------------
> >     Traceback (most recent call last):
> >       File "/home/sfinucan/innovation/patchwork/patchwork/patchwork/tests/test_rest_api.py", line 274, in test_detail_tags
> >         self.assertEqual(1, len(tags))
> >     AssertionError: 1 != 0
> >
> >I'm guessing it's due to some side effect, but I haven't figured out
> >what's causing this yet. Mind taking a look?
> 
> Weird issue, and I'm not positive you'll like this workaround:
> 
>      def test_detail_tags(self):
> +        # defaults.project is remembered between TestCases and .save()
> +        # is called which just updates the object. This leaves the
> +        # potential for the @cached_property project.tags to be
> +        # invalid, so we have to invalidate this cached value before
> +        # doing tag operations:
> +        del defaults.project.tags
>          patches = create_patches()
> 
> So the workaround is really just addressing a symptom of the
> test-suite: We don't actually delete/re-create the project between
> runs, so it can cache bad stuff. I'm fine with adding this
> workaround to the patch. I think doing a "real fix" would be much
> more systemic and beyond the scope of this work.

I agree that this is out of scope of this work. I've been working on
removing 'defaults' and generally cleaning up the tests over the past
few evenings. I should complete this before the weekend. In the interim
and, noting what you said above, I'm happy to use this workaround for
now. Let me validate then we can probably get to merging.

Stephen

PS: No need to resubmit - I can do address this and the above.


More information about the Patchwork mailing list