aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2014-01-08 14:13:30 +0100
committerMatěj Cepl <mcepl@redhat.com>2014-01-11 11:31:39 +0100
commit9a43d17636e6f77eb93d5c4d3653f36b3348851a (patch)
tree3ea5cb61ee0557ab560be4dc08e76f8ce348e93e /test
parent532b2f96e27201df320988ab2a61dadd230843a7 (diff)
downloadgg_scraper-9a43d17636e6f77eb93d5c4d3653f36b3348851a.tar.gz
Make whole script comaptible with python 2.6
How low we fell :( Also: * On Python 2.6 we have to send bytes to proc.communicate() not unicode str (Fixes #288)
Diffstat (limited to 'test')
-rw-r--r--test/test_functional.py7
-rw-r--r--test/test_unit.py9
2 files changed, 12 insertions, 4 deletions
diff --git a/test/test_functional.py b/test/test_functional.py
index c8f5bf2..2c3ad27 100644
--- a/test/test_functional.py
+++ b/test/test_functional.py
@@ -3,7 +3,10 @@
import logging
import io
import os.path
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gg_scraper
IN_URL = 'https://groups.google.com/forum/#!forum/jbrout'
@@ -23,7 +26,7 @@ class TestGGScrapperFunctional(unittest.TestCase):
self.assertGreater(len(topics), 0)
def test_collecting_articles(self):
- logging.debug('topic = URL {}'.format(TOPIC_URL))
+ logging.debug('topic = URL {0}'.format(TOPIC_URL))
topic = gg_scraper.Topic(TOPIC_URL,
'repo version incompatible with ' +
'ubuntu 11.04 ?')
diff --git a/test/test_unit.py b/test/test_unit.py
index 503aafe..b286f97 100644
--- a/test/test_unit.py
+++ b/test/test_unit.py
@@ -1,7 +1,11 @@
import os
import tempfile
import yaml
-import unittest
+import sys
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gg_scraper
from gg_scraper import Group, Topic, Article # noqa
@@ -27,6 +31,7 @@ class TestMBOX(unittest.TestCase):
with open(group_file_name, 'r') as group_f:
self.group = yaml.load(group_f)
+ @unittest.skipIf(sys.version_info[:2] < (2, 7), 'Formatting on 2.6 is different')
def test_create_mbox(self):
'''Create a mbox file from (YAMLed) Group
'''
@@ -47,7 +52,7 @@ class TestMBOX(unittest.TestCase):
self.group.collect_mangled_addrs()
- with open('{}.cnf'.format(self.group.name)) as obs_f:
+ with open('{0}.cnf'.format(self.group.name)) as obs_f:
mang_addres = obs_f.read()
self.assertEqual(exp_str, mang_addres)