1. Patrick Mézard
  2. hgmbox

Commits

Patrick Mézard  committed f7672bd

tests: no need to generate the mbox with a python script

We can edit them manually, and add a bit of documentation in messages.txt.

  • Participants
  • Parent commits 4e76b8c
  • Branches default

Comments (0)

Files changed (6)

File tests/makeencoding.py

-#!/usr/bin/env python
-#
-# Run this script to generate the mbox test sample
-#
-import email, mailbox, os
-
-# Fill the test mailbox
-if os.path.isfile('testencoding.mbx'):
-    os.remove('testencoding.mbx')
-mbox = mailbox.mbox('testencoding.mbx')
-
-mbox.add(email.message_from_file(file('msg.base64')))
-
-mbox.close()

File tests/makembox.py

-#!/usr/bin/env python
-#
-# Run this script to generate the mbox test sample
-#
-import email, mailbox, os
-
-# Fill the test mailbox
-os.remove('test.mbx')
-mbox = mailbox.mbox('test.mbx')
-
-mbox.add(email.message_from_file(file('msg1')))
-
-# Add a different patch with the same name from the same author
-# It should hide the previous one
-mbox.add(email.message_from_file(file('msg2')))
-
-# Another a patch with a different title
-mbox.add(email.message_from_file(file('msg3')))
-
-mbox.close()

File tests/makembox2.py

-#!/usr/bin/env python
-#
-# Run this script to generate the mbox test sample
-#
-import email, mailbox, os
-
-# Fill the test mailbox
-if os.path.isfile('test2.mbx'):
-    os.remove('test2.mbx')
-mbox = mailbox.mbox('test2.mbx')
-
-# Sequence of 3 parentless patches from the same author
-mbox.add(email.message_from_file(file('msg2.0')))
-mbox.add(email.message_from_file(file('msg2.1')))
-mbox.add(email.message_from_file(file('msg2.2')))
-# One patch among 3 from another author, same date as previous ones
-mbox.add(email.message_from_file(file('msg2.3')))
-# One standalone patch of the first author, coming later
-mbox.add(email.message_from_file(file('msg2.4')))
-# One mail which doesn't contain a patch
-mbox.add(email.message_from_file(file('msg2.5')))
-
-mbox.close()

File tests/makembox3.py

-#!/usr/bin/env python
-#
-# Run this script to generate the mbox test sample
-#
-import email, mailbox, os
-
-# Fill the test mailbox
-if os.path.isfile('test3.mbx'):
-    os.remove('test3.mbx')
-mbox = mailbox.mbox('test3.mbx')
-
-# Sequence of 2 parentless patches from the same author without intro message
-mbox.add(email.message_from_file(file('msg2.1')))
-mbox.add(email.message_from_file(file('msg2.2')))
-# One patch among 3 from another author, same date as previous ones
-mbox.add(email.message_from_file(file('msg2.3')))
-# One standalone patch of the first author, coming later
-mbox.add(email.message_from_file(file('msg2.4')))
-
-mbox.close()

File tests/messages.txt

View file
+Description of the mboxes contents
+==================================
+
+test.mbx
+--------
+[PATCH] patch1
+# Add a different patch with the same name from the same author
+# It should hide the previous one  
+[PATCH] patch1
+# Another a patch with a different title
+[PATCH] some/complicated: patch2  <name>
+
+test2.mbx
+---------
+# Sequence of 3 parentless patches from the same author
+[PATCH 0 of 2] header
+[PATCH 1 of 2] patch 1 of 2
+[PATCH 2 of 2] patch 2 of 2
+# One patch among 3 from another author, same date as previous ones
+[PATCH 2 of 2] patch 2 of 2, single
+[PATCH] standalone
+[PATCH] cheating
+
+test3.mbx
+---------
+# Sequence of 2 parentless patches from the same author without intro message
+[PATCH 1 of 2] patch 1 of 2
+[PATCH 2 of 2] patch 2 of 2
+# One patch among 3 from another author, same date as previous ones
+[PATCH 2 of 2] patch 2 of 2, single
+# One standalone patch of the first author, coming later
+[PATCH] standalone
+
+testencoding.mbx
+----------------
+# Patch with base64 attachment
+[PATCH 1 of 1 stable] templatefilters: use \uxxxx style escape for JSON string

File tests/test.mbx

View file
         Mon, 29 Dec 2008 17:13:30 -0800 (PST)
 MIME-Version: 1.0
 Subject: [PATCH] patch1
-Message-Id: <5ab3c4562bd574dbd782.1230599538@localhost>
+Message-Id: <5ab3c4562bd574dbd782.1230599536@localhost>
 Date: Tue, 16 Dec 2008 02:12:18 +0100
 From: Bar Baz <barbaz@gmail.com>
 To: mercurial-devel@selenic.com
         Mon, 29 Dec 2008 17:13:30 -0800 (PST)
 MIME-Version: 1.0
 Subject: [PATCH] patch1
-Message-Id: <5ab3c4562bd574dbd782.1230599538@localhost>
+Message-Id: <5ab3c4562bd574dbd782.1230599537@localhost>
 Date: Tue, 29 Dec 2008 03:12:18 +0100
 From: Bar Baz <barbaz@gmail.com>
 To: mercurial-devel@selenic.com