]> git.ipfire.org Git - thirdparty/patchwork.git/commit
parsemail: Clarify exit codes
authorDaniel Axtens <dja@axtens.net>
Mon, 30 Apr 2018 15:44:59 +0000 (01:44 +1000)
committerStephen Finucane <stephen@that.guru>
Thu, 3 May 2018 14:05:18 +0000 (15:05 +0100)
commitd2eb1f6d20835713c9560bd55abf6d6da0b91ce2
treea8e242d2b9f122771a8ca0d382b03156a16c1e92
parent29c704a9a1a4014cb7be3415099f7660d26f9867
parsemail: Clarify exit codes

jk reports that the patchwork error codes are really unhelpful for
correct integration with an MDA. In particular they make sorting out
failures into a separate queue very difficult. Make this better and
clearer: only return 1 on a genuinely unexpected case that requires
adminstrator intervention.

Update the comment for parse_mail regarding return values and exceptions
to line up with how the function actually works and how we use the
results.

Update the tests. None of the existing tests should exit 1; they're
all 'expected' failures: unknown project etc. Also we removed the
exit(0) from the success path, so stop expecting that exception to
be raised.

Add a test for duplicates. That should also succeed without raising
an exception: dups are part of life.

Update parsearchive to deal with the fact that we can no longer
differentiate duplicates.

Reported-by: Jeremy Kerr <jk@ozlabs.org>
Fixes: #171
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/management/commands/parsearchive.py
patchwork/management/commands/parsemail.py
patchwork/parser.py
patchwork/tests/test_management.py