summaryrefslogtreecommitdiffstats
path: root/patchwork/bin/parsemail.py
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-05-28 13:44:14 +0800
committerJeremy Kerr <jk@ozlabs.org>2015-05-28 13:59:36 +0800
commit85916e6c56076a29c6113e169d3e4926a7c886b1 (patch)
tree6e457d6f6a7889d50eda9e6fd04d370671a03d60 /patchwork/bin/parsemail.py
parentf7aeab077874d33fc99354661bfeedf508c292b3 (diff)
downloadpatchwork-85916e6c56076a29c6113e169d3e4926a7c886b1.tar.bz2
patchwork-85916e6c56076a29c6113e169d3e4926a7c886b1.tar.xz
tests: Remove old-style test runner module
We get the following warning on django 1.7: System check identified some issues: WARNINGS: ?: (1_6.W001) Some project unittests may not execute as expected. HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information. This change removes the unneeded base test module, and moves the patchparser doctests into a proper test module. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'patchwork/bin/parsemail.py')
-rwxr-xr-xpatchwork/bin/parsemail.py54
1 files changed, 4 insertions, 50 deletions
diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 19e6e57..5cb0b50 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -267,23 +267,8 @@ def find_patch_for_comment(project, mail):
split_re = re.compile('[,\s]+')
def split_prefixes(prefix):
- """ Turn a prefix string into a list of prefix tokens
-
- >>> split_prefixes('PATCH')
- ['PATCH']
- >>> split_prefixes('PATCH,RFC')
- ['PATCH', 'RFC']
- >>> split_prefixes('')
- []
- >>> split_prefixes('PATCH,')
- ['PATCH']
- >>> split_prefixes('PATCH ')
- ['PATCH']
- >>> split_prefixes('PATCH,RFC')
- ['PATCH', 'RFC']
- >>> split_prefixes('PATCH 1/2')
- ['PATCH', '1/2']
- """
+ """ Turn a prefix string into a list of prefix tokens """
+
matches = split_re.split(prefix)
return [ s for s in matches if s != '' ]
@@ -296,39 +281,8 @@ def clean_subject(subject, drop_prefixes = None):
Removes Re: and Fwd: strings, as well as [PATCH]-style prefixes. By
default, only [PATCH] is removed, and we keep any other bracketed data
in the subject. If drop_prefixes is provided, remove those too,
- comparing case-insensitively.
-
- >>> clean_subject('meep')
- 'meep'
- >>> clean_subject('Re: meep')
- 'meep'
- >>> clean_subject('[PATCH] meep')
- 'meep'
- >>> clean_subject('[PATCH] meep \\n meep')
- 'meep meep'
- >>> clean_subject('[PATCH RFC] meep')
- '[RFC] meep'
- >>> clean_subject('[PATCH,RFC] meep')
- '[RFC] meep'
- >>> clean_subject('[PATCH,1/2] meep')
- '[1/2] meep'
- >>> clean_subject('[PATCH RFC 1/2] meep')
- '[RFC,1/2] meep'
- >>> clean_subject('[PATCH] [RFC] meep')
- '[RFC] meep'
- >>> clean_subject('[PATCH] [RFC,1/2] meep')
- '[RFC,1/2] meep'
- >>> clean_subject('[PATCH] [RFC] [1/2] meep')
- '[RFC,1/2] meep'
- >>> clean_subject('[PATCH] rewrite [a-z] regexes')
- 'rewrite [a-z] regexes'
- >>> clean_subject('[PATCH] [RFC] rewrite [a-z] regexes')
- '[RFC] rewrite [a-z] regexes'
- >>> clean_subject('[foo] [bar] meep', ['foo'])
- '[bar] meep'
- >>> clean_subject('[FOO] [bar] meep', ['foo'])
- '[bar] meep'
- """
+ comparing case-insensitively."""
+
subject = clean_header(subject)