diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2020-07-01 16:16:44 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2020-07-01 16:19:16 +0200 |
commit | d5fc1faf927a5ff91f3416eb97014c0eadb14742 (patch) | |
tree | 2cb34082a4df13685c2ee0f46e1360cfdf4a8e88 /test | |
parent | 19388fa2e3e6b02e7d7fd5c0b5dc9ee0cd9ef100 (diff) | |
download | pyg-d5fc1faf927a5ff91f3416eb97014c0eadb14742.tar.gz |
Sync with 0.10.1 release on PyPI0.10.1
Port to Python 3.
Diffstat (limited to 'test')
-rw-r--r--[-rwxr-xr-x] | test/test_pyg.py | 22 | ||||
-rw-r--r--[-rwxr-xr-x] | test/test_wlp.py | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/test/test_pyg.py b/test/test_pyg.py index ddf8146..d3fa3a7 100755..100644 --- a/test/test_pyg.py +++ b/test/test_pyg.py @@ -1,10 +1,12 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- + +from __future__ import absolute_import import re import subprocess import unittest import mail2news -import news2mail class TestM2N(unittest.TestCase): @@ -26,7 +28,12 @@ one line test """ % (mail2news.VERSION, mail2news.DESC) def test_m2n(self): - out = mail2news.main(['-T', '-v', '-i', 'examples/mail', '-n', 'pyg.test']) + with open('examples/mail') as in_mail: + pid = subprocess.Popen(['python', 'pygm2n', '-Tv', '-n', 'pyg.test'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + universal_newlines=True) + out, _ = pid.communicate(in_mail.read()) self.assertEqual(out, self.expected_output) @@ -53,17 +60,22 @@ Resent-Sender: sender@example.com def test_n2m(self): with open('examples/articletest.accepted') as in_mail: + pid = subprocess.Popen(['python', 'pygn2m', '-Tvt', 'test@example.com', + '-s', 'sender@example.com', + '-w', 'examples/whitelist.example'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + universal_newlines=True) in_message = in_mail.read().replace('pyg@pyg.server.tld', 'kame@inwind.it') - out = news2mail.main(['-T', '-v', '-t', 'test@example.com', - '-s', 'sender@example.com', - '-w', 'examples/whitelist.example']) + out, err = pid.communicate(in_message) out = re.sub(r'^Message-Id:.*$', '', out) # Not sure how to compare two email mesages (with different # times, etc.) so for now just to make sure the script doesn’t # blow up and gives some output # otherwise it would be # self.assertEqual(out, expected_output) + self.assertEqual(pid.returncode, 0) self.assertGreater(len(out), 0) diff --git a/test/test_wlp.py b/test/test_wlp.py index 929fb1c..061673c 100755..100644 --- a/test/test_wlp.py +++ b/test/test_wlp.py @@ -1,4 +1,6 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- +from __future__ import absolute_import import unittest import wlp_parser |