def test_match(self, tmpdir, cmd): p = cmd.create_issues( [("do_something", dict(path="somedir/some.py"), "")]) issues = list(ciss.parseissues(p)) assert len(issues) == 1 issue = issues[0] assert issue.match(path=tmpdir.join("somedir")) assert not issue.match(path=tmpdir.join("otherdir", 'some1.py')) assert issue.match(path=tmpdir.join("somedir", 'some.py')) assert issue.match(path=tmpdir.join("somedir"))
def test_match_tags(self, tmpdir, cmd): p = cmd.create_issues( [("do_something", dict(tags="one two three"), ""),]) issues = list(ciss.parseissues(p)) assert len(issues) == 1 issue = issues[0] assert issue.match(tags=['one']) assert issue.match(tags=['one', 'two']) assert not issue.match(tags=['one', 'four']) assert issue.match(tags=['three']) assert not issue.match(tags=['four']) assert issue.match()
def test_match_no_pattern(self, tmpdir, cmd): p = tmpdir.join("ISSUES.txt") p.write(py.code.Source(""" do something -------------- text """)) issues = list(ciss.parseissues(p)) assert len(issues) == 1 issue = issues[0] assert not issue.match(path=tmpdir.join("somedir")) assert not issue.match(path=tmpdir.join("somedir", 'xyz.py')) assert not issue.match(path=tmpdir.join("somedir", 'some1.py'))
def test_readtags(self, tmpdir): p = tmpdir.join("issues.txt") p.write(py.code.Source(""" do something -------------- tags: 1.0,bug text do_more ------------ tags: 1.1 feature """)) issues = list(ciss.parseissues(p)) assert len(issues) == 2 assert issues[0].readtags() == ['1.0', 'bug'] assert issues[1].readtags() == ['1.1', 'feature']
def test_parse_one(tmpdir): p = tmpdir.join("issues.txt") p.write(py.code.Source(""" title -------------- key: value key2: value2 text """)) issues = list(ciss.parseissues(p)) assert len(issues) == 1 issue = issues[0] assert issue.title == "title" assert issue.param['key'] == "value" assert issue.param['key2'] == "value2" assert issue.body == "text"
def test_parse_two_empty_body(tmpdir): p = tmpdir.join("issues.txt") p.write(py.code.Source(""" title -------------- key: value title2 -------------- """)) issues = list(ciss.parseissues(p)) assert len(issues) == 2 assert issues[0].title == "title" assert issues[0].body == "" assert issues[0].param['key'] == "value" assert issues[1].title == "title2" assert issues[1].body == ""
def test_parse_two(tmpdir): p = tmpdir.join("issues.txt") p.write(py.code.Source(""" title1 -------------- key1: value1 text title2 ---------------- key2: value2 text2a text2b """)) issues = list(ciss.parseissues(p)) assert len(issues) == 2 issue1, issue2 = issues assert issue1.title == "title1" assert issue1.param['key1'] == "value1" assert issue1.body == "text" assert issue2.title == "title2" assert issue2.param['key2'] == "value2" assert issue2.body == "text2a\ntext2b"