Changeset - 082780404e6c
[Not reviewed]
default
0 6 0
Mads Kiilerich - 6 years ago 2019-12-16 02:29:34
mads@kiilerich.com
Grafted from: 3ebc4af045e2
cleanup: fix incorrect backslash escaping - mainly in regexps
6 files changed with 35 insertions and 35 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/api/api_base.py
Show inline comments
 
@@ -2509,7 +2509,7 @@ class _BaseTestApi(object):
 
            "revisions": self.TEST_PR_REVISIONS,
 
        }
 
        self._compare_ok(random_id, expected,
 
                         given=re.sub("\d\d\d\d\-\d\d\-\d\dT\d\d\:\d\d\:\d\d",
 
                         given=re.sub(r"\d\d\d\d\-\d\d\-\d\dT\d\d\:\d\d\:\d\d",
 
                                      "2000-01-01T00:00:00", response.body))
 

	
 
    def test_api_close_pullrequest(self):
kallithea/tests/functional/test_changeset_pullrequests_comments.py
Show inline comments
 
@@ -168,7 +168,7 @@ class TestPullrequestsCommentsController
 
                                  '_session_csrf_secret_token': self.session_csrf_secret_token(),
 
                                 },
 
                                 status=302)
 
        pr_id = int(re.search('/pull-request/(\d+)/', response.location).group(1))
 
        pr_id = int(re.search(r'/pull-request/(\d+)/', response.location).group(1))
 
        return pr_id
 

	
 
    def test_create(self):
kallithea/tests/functional/test_pullrequests.py
Show inline comments
 
@@ -94,7 +94,7 @@ class TestPullrequestsController(TestCon
 
                                  '_session_csrf_secret_token': self.session_csrf_secret_token(),
 
                                 },
 
                                 status=302)
 
        pull_request1_id = re.search('/pull-request/(\d+)/', response.location).group(1)
 
        pull_request1_id = re.search(r'/pull-request/(\d+)/', response.location).group(1)
 
        assert response.location == 'http://localhost/%s/pull-request/%s/_/stable' % (HG_REPO, pull_request1_id)
 

	
 
        # create new iteration
 
@@ -109,7 +109,7 @@ class TestPullrequestsController(TestCon
 
                                  'review_members': [regular_user.user_id],
 
                                 },
 
                                 status=302)
 
        pull_request2_id = re.search('/pull-request/(\d+)/', response.location).group(1)
 
        pull_request2_id = re.search(r'/pull-request/(\d+)/', response.location).group(1)
 
        assert pull_request2_id != pull_request1_id
 
        assert response.location == 'http://localhost/%s/pull-request/%s/_/stable' % (HG_REPO, pull_request2_id)
 
        response = response.follow()
 
@@ -155,7 +155,7 @@ class TestPullrequestsController(TestCon
 
                                status=302)
 
        # location is of the form:
 
        # http://localhost/vcs_test_hg/pull-request/54/_/title
 
        m = re.search('/pull-request/(\d+)/', response.location)
 
        m = re.search(r'/pull-request/(\d+)/', response.location)
 
        assert m is not None
 
        pull_request_id = m.group(1)
 

	
 
@@ -191,7 +191,7 @@ class TestPullrequestsController(TestCon
 
                                status=302)
 
        # location is of the form:
 
        # http://localhost/vcs_test_hg/pull-request/54/_/title
 
        m = re.search('/pull-request/(\d+)/', response.location)
 
        m = re.search(r'/pull-request/(\d+)/', response.location)
 
        assert m is not None
 
        pull_request_id = m.group(1)
 

	
 
@@ -237,7 +237,7 @@ class TestPullrequestsController(TestCon
 
                '_session_csrf_secret_token': self.session_csrf_secret_token(),
 
            },
 
            status=302)
 
        pr1_id = int(re.search('/pull-request/(\d+)/', response.location).group(1))
 
        pr1_id = int(re.search(r'/pull-request/(\d+)/', response.location).group(1))
 
        pr1 = PullRequest.get(pr1_id)
 

	
 
        assert pr1.org_ref == 'branch:webvcs:9e6119747791ff886a5abe1193a730b6bf874e1c'
 
@@ -256,7 +256,7 @@ class TestPullrequestsController(TestCon
 
                '_session_csrf_secret_token': self.session_csrf_secret_token(),
 
             },
 
             status=302)
 
        pr2_id = int(re.search('/pull-request/(\d+)/', response.location).group(1))
 
        pr2_id = int(re.search(r'/pull-request/(\d+)/', response.location).group(1))
 
        pr1 = PullRequest.get(pr1_id)
 
        pr2 = PullRequest.get(pr2_id)
 

	
 
@@ -278,7 +278,7 @@ class TestPullrequestsController(TestCon
 
                '_session_csrf_secret_token': self.session_csrf_secret_token(),
 
             },
 
             status=302)
 
        pr3_id = int(re.search('/pull-request/(\d+)/', response.location).group(1))
 
        pr3_id = int(re.search(r'/pull-request/(\d+)/', response.location).group(1))
 
        pr2 = PullRequest.get(pr2_id)
 
        pr3 = PullRequest.get(pr3_id)
 

	
kallithea/tests/other/test_libs.py
Show inline comments
 
@@ -482,7 +482,7 @@ class TestLibs(TestController):
 
            """empty issue_sub <a class="issue-tracker-link" href="http://foo/repo_name/issue/123">$123</a> and """
 
            """issue$456"""),
 
        # named groups
 
        (r'(PR|pullrequest|pull request) ?(?P<sitecode>BRU|CPH|BER)-(?P<id>\d+)', 'http://foo/\g<sitecode>/pullrequest/\g<id>/', 'PR-\g<sitecode>-\g<id>',
 
        (r'(PR|pullrequest|pull request) ?(?P<sitecode>BRU|CPH|BER)-(?P<id>\d+)', r'http://foo/\g<sitecode>/pullrequest/\g<id>/', r'PR-\g<sitecode>-\g<id>',
 
            'pullrequest CPH-789 is similar to PRBRU-747',
 
            """<a class="issue-tracker-link" href="http://foo/CPH/pullrequest/789/">PR-CPH-789</a> is similar to """
 
            """<a class="issue-tracker-link" href="http://foo/BRU/pullrequest/747/">PR-BRU-747</a>"""),
 
@@ -512,21 +512,21 @@ class TestLibs(TestController):
 
    def test_urlify_issues_multiple_issue_patterns(self, sample, expected):
 
        from kallithea.lib.helpers import urlify_text
 
        config_stub = {
 
            'sqlalchemy.url': 'foo',
 
            'issue_pat': 'X(\d+)',
 
            'issue_server_link': 'http://main/{repo}/main/\\1/',
 
            'issue_sub': '#\\1',
 
            'issue_pat_pr': '(?:pullrequest|pull request|PR|pr) ?#?(\d+)',
 
            'issue_server_link_pr': 'http://pr/{repo}/pr/\\1',
 
            'issue_sub_pr': 'PR#\\1',
 
            'issue_pat_bug': '(?:BUG|bug|issue) ?#?(\d+)',
 
            'issue_server_link_bug': 'http://bug/{repo}/bug/\\1',
 
            'issue_sub_bug': 'bug#\\1',
 
            'issue_pat_empty_prefix': 'FAIL(\d+)',
 
            'issue_server_link_empty_prefix': 'http://fail/{repo}/\\1',
 
            'issue_sub_empty_prefix': '',
 
            'issue_pat_absent_prefix': 'FAILMORE(\d+)',
 
            'issue_server_link_absent_prefix': 'http://failmore/{repo}/\\1',
 
            'sqlalchemy.url': r'foo',
 
            'issue_pat': r'X(\d+)',
 
            'issue_server_link': r'http://main/{repo}/main/\1/',
 
            'issue_sub': r'#\1',
 
            'issue_pat_pr': r'(?:pullrequest|pull request|PR|pr) ?#?(\d+)',
 
            'issue_server_link_pr': r'http://pr/{repo}/pr/\1',
 
            'issue_sub_pr': r'PR#\1',
 
            'issue_pat_bug': r'(?:BUG|bug|issue) ?#?(\d+)',
 
            'issue_server_link_bug': r'http://bug/{repo}/bug/\1',
 
            'issue_sub_bug': r'bug#\1',
 
            'issue_pat_empty_prefix': r'FAIL(\d+)',
 
            'issue_server_link_empty_prefix': r'http://fail/{repo}/\1',
 
            'issue_sub_empty_prefix': r'',
 
            'issue_pat_absent_prefix': r'FAILMORE(\d+)',
 
            'issue_server_link_absent_prefix': r'http://failmore/{repo}/\1',
 
        }
 
        # force recreation of lazy function
 
        with mock.patch('kallithea.lib.helpers._urlify_issues_f', None):
kallithea/tests/scripts/manual_test_crawler.py
Show inline comments
 
@@ -130,13 +130,13 @@ def test_changeset_walk(proj, limit=None
 
            break
 

	
 
        full_uri = (BASE_URI % raw_cs)
 
        print('%s visiting %s\%s' % (cnt, full_uri, i))
 
        print('%s visiting %s/%s' % (cnt, full_uri, i))
 
        s = time.time()
 
        f = o.open(full_uri)
 
        size = len(f.read())
 
        e = time.time() - s
 
        total_time += e
 
        print('%s visited %s\%s size:%s req:%s ms' % (cnt, full_uri, i, size, e))
 
        print('%s visited %s/%s size:%s req:%s ms' % (cnt, full_uri, i, size, e))
 

	
 
    print('total_time', total_time)
 
    print('average on req', total_time / float(cnt))
kallithea/tests/vcs/test_repository.py
Show inline comments
 
@@ -110,7 +110,7 @@ class TestGitRepositoryGetDiff(Repositor
 

	
 
    def test_initial_commit_diff(self):
 
        initial_rev = self.repo.revisions[0]
 
        assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == r'''diff --git a/foobar b/foobar
 
new file mode 100644
 
index 0000000000000000000000000000000000000000..f6ea0495187600e7b2288c8ac19c5886383a4632
 
--- /dev/null
 
@@ -130,7 +130,7 @@ index 0000000000000000000000000000000000
 

	
 
    def test_second_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[0], revs[1]) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(revs[0], revs[1]) == r'''diff --git a/foobar b/foobar
 
index f6ea0495187600e7b2288c8ac19c5886383a4632..389865bb681b358c9b102d79abd8d5f941e96551 100644
 
--- a/foobar
 
+++ b/foobar
 
@@ -151,7 +151,7 @@ index 0000000000000000000000000000000000
 

	
 
    def test_third_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[1], revs[2]) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(revs[1], revs[2]) == r'''diff --git a/foobar b/foobar
 
deleted file mode 100644
 
index 389865bb681b358c9b102d79abd8d5f941e96551..0000000000000000000000000000000000000000
 
--- a/foobar
 
@@ -173,7 +173,7 @@ index c11c37d41d33fb47741cff93fa5f9d798c
 

	
 
    def test_fourth_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[2], revs[3]) == '''diff --git a/README{ b/README{
 
        assert self.repo.get_diff(revs[2], revs[3]) == r'''diff --git a/README{ b/README{
 
new file mode 100644
 
index 0000000000000000000000000000000000000000..cdc0c1b5d234feedb37bbac19cd1b6442061102d
 
--- /dev/null
 
@@ -189,7 +189,7 @@ class TestHgRepositoryGetDiff(Repository
 

	
 
    def test_initial_commit_diff(self):
 
        initial_rev = self.repo.revisions[0]
 
        assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == r'''diff --git a/foobar b/foobar
 
new file mode 100644
 
--- /dev/null
 
+++ b/foobar
 
@@ -207,7 +207,7 @@ new file mode 100644
 

	
 
    def test_second_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[0], revs[1]) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(revs[0], revs[1]) == r'''diff --git a/foobar b/foobar
 
--- a/foobar
 
+++ b/foobar
 
@@ -1,1 +1,1 @@
 
@@ -226,7 +226,7 @@ new file mode 100644
 

	
 
    def test_third_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[1], revs[2]) == '''diff --git a/foobar b/foobar
 
        assert self.repo.get_diff(revs[1], revs[2]) == r'''diff --git a/foobar b/foobar
 
deleted file mode 100644
 
--- a/foobar
 
+++ /dev/null
 
@@ -246,7 +246,7 @@ diff --git a/foobar3 b/foobar3
 

	
 
    def test_fourth_changeset_diff(self):
 
        revs = self.repo.revisions
 
        assert self.repo.get_diff(revs[2], revs[3]) == '''diff --git a/README{ b/README{
 
        assert self.repo.get_diff(revs[2], revs[3]) == r'''diff --git a/README{ b/README{
 
new file mode 100644
 
--- /dev/null
 
+++ b/README{
0 comments (0 inline, 0 general)