default to empty notes field
authorJim Witschey <jim.witschey@gmail.com>
Thu, 28 Jul 2016 22:37:14 +0000 (18:37 -0400)
committerJim Witschey <jim.witschey@gmail.com>
Thu, 4 Aug 2016 20:52:29 +0000 (16:52 -0400)
commitda64afad6351f3b6d0ab368e9c75230e27810ef5
tree9b7809fbce8d6bdb7fbb0946aac8f9b10f2ffd09
parent16845139a2166e04721b7c23a0d9b78fd7ffd40f
default to empty notes field

This will make double-annotation with known_failure work as expected
with the notes parameter - if you tag it twice, but omit notes in the
outer decorator, the notes will be an empty string.

Tested with the following:

test_notes.py:
```
from dtest import Tester
from tools import known_failure

class TestNotes(Tester):
    @known_failure(failure_source='test',
                   jira_url='only',
                   notes='only')
    def test1():
        """single decorator with notes, expect notes='only'"""

    @known_failure(failure_source='test',
                   jira_url='only')
    def test2():
        """single decorator without notes, expect notes=''"""

    @known_failure(failure_source='test',
                   jira_url='outer',
                   notes='outer')
    @known_failure(failure_source='test',
                   jira_url='inner')
    def test3():
        """double, outside has notes, inside no notes, expect notes='outer'"""

    @known_failure(failure_source='test',
                   jira_url='outer')
    @known_failure(failure_source='test',
                   jira_url='inner',
                   notes='inner')
    def test4():
        """double, outside no notes, inside has notes, expect notes=''"""

    @known_failure(failure_source='test',
                   jira_url='outer',
                   notes='outer')
    @known_failure(failure_source='test',
                   jira_url='inner',
                   notes='inner')
    def test5():
        """double, both have notes"""

    @known_failure(failure_source='test',
                   jira_url='outer')
    @known_failure(failure_source='test',
                   jira_url='inner')
    def test6():
        """double, neither have notes, expect notes=''"""
```

Running `python bin/collect_known_failures.py test_notes.py` gave the
expected output:

```
{"name": "TestNotes.test1", "jira_url": "only", "notes": "only", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok
{"name": "TestNotes.test2", "jira_url": "only", "notes": "", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok
{"name": "TestNotes.test3", "jira_url": "outer", "notes": "outer", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok
{"name": "TestNotes.test4", "jira_url": "outer", "notes": "", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok
{"name": "TestNotes.test5", "jira_url": "outer", "notes": "outer", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok
{"name": "TestNotes.test6", "jira_url": "outer", "notes": "", "module": "test_notes", "known_flaky": false, "failure_source": "test"} ... ok

----------------------------------------------------------------------
Ran 6 tests in 0.002s

OK
```
tools.py