2 from multiprocessing import Queue
4 from nose.tools import eq_, raises
6 from ..processor import DONE, Processor
10 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/"
11 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12 xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/
13 http://www.mediawiki.org/xml/export-0.8.xsd"
14 version="0.8" xml:lang="en">
16 <sitename>Wikipedia</sitename>
17 <base>http://en.wikipedia.org/wiki/Main_Page</base>
18 <generator>MediaWiki 1.22wmf2</generator>
19 <case>first-letter</case>
21 <namespace key="0" case="first-letter" />
22 <namespace key="1" case="first-letter">Talk</namespace>
31 <timestamp>2004-08-09T09:04:08Z</timestamp>
33 <username>Gen0cide</username>
36 <text xml:space="preserve">Revision 1 text</text>
37 <sha1>g9chqqg94myzq11c56ixvq7o1yg75n9</sha1>
38 <model>wikitext</model>
39 <format>text/x-wiki</format>
43 <timestamp>2004-08-10T09:04:08Z</timestamp>
45 <ip>222.152.210.109</ip>
47 <text xml:space="preserve">Revision 2 text</text>
48 <sha1>g9chqqg94myzq11c56ixvq7o1yg75n9</sha1>
49 <model>wikitext</model>
50 <comment>Comment 2</comment>
51 <format>text/x-wiki</format>
60 <timestamp>2004-08-11T09:04:08Z</timestamp>
62 <ip>222.152.210.22</ip>
64 <text xml:space="preserve">Revision 3 text</text>
65 <sha1>g9chqqg94myzq11c56ixvq7o1yg75n9</sha1>
66 <model>wikitext</model>
67 <format>text/x-wiki</format>
77 pathq.put(io.StringIO(SAMPLE_XML))
81 def process_dump(dump, path):
86 processor = Processor(pathq, outputq, process_dump)
89 error, item = outputq.get()
93 error, item = outputq.get()
97 error, item = outputq.get()
101 def test_processor_error():
104 pathq.put(io.StringIO(SAMPLE_XML))
108 def process_dump(dump, path):
109 raise Exception("foo")
112 processor = Processor(pathq, outputq, process_dump)
115 error, item = outputq.get()
118 error, item = outputq.get()