Commit a0a50ba9 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Remove support for Python 3.2.

It's a 4 year old version of Python and some libraries are no longer
supporting it anymore. This removes some hairy code to support Python
3.2 any longer.
parent 5092a3b9
...@@ -2,7 +2,6 @@ sudo: false # run on new infrastructure ...@@ -2,7 +2,6 @@ sudo: false # run on new infrastructure
language: python language: python
python: python:
- "2.7" - "2.7"
- "3.2"
- "3.3" - "3.3"
- "3.4" - "3.4"
install: install:
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
from six import u from six import u
import codecs import codecs
import re import re
import sys
import unittest import unittest
from topydo.lib.Config import config from topydo.lib.Config import config
...@@ -261,13 +260,10 @@ def replace_ical_tags(p_text): ...@@ -261,13 +260,10 @@ def replace_ical_tags(p_text):
return result return result
IS_PYTHON_32 = (sys.version_info.major, sys.version_info.minor) == (3, 2)
class ListCommandIcalTest(CommandTest): class ListCommandIcalTest(CommandTest):
def setUp(self): def setUp(self):
self.maxDiff = None self.maxDiff = None
@unittest.skipIf(IS_PYTHON_32, "icalendar is not supported for Python 3.2")
def test_ical(self): def test_ical(self):
todolist = load_file_to_todolist("test/data/ListCommandIcalTest.txt") todolist = load_file_to_todolist("test/data/ListCommandIcalTest.txt")
...@@ -283,21 +279,6 @@ class ListCommandIcalTest(CommandTest): ...@@ -283,21 +279,6 @@ class ListCommandIcalTest(CommandTest):
self.assertEqual(replace_ical_tags(self.output), replace_ical_tags(icaltext)) self.assertEqual(replace_ical_tags(self.output), replace_ical_tags(icaltext))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
@unittest.skipUnless(IS_PYTHON_32, "icalendar is not supported for Python 3.2")
def test_ical_python32(self):
"""
Test case for Python 3.2 where icalendar is not supported.
"""
todolist = load_file_to_todolist("test/data/ListCommandTest.txt")
command = ListCommand(["-f", "ical"], todolist, self.out, self.error)
command.execute()
self.assertFalse(todolist.is_dirty())
self.assertEqual(self.output, '')
self.assertEqual(self.errors, "icalendar is not supported in this Python version.\n")
@unittest.skipIf(IS_PYTHON_32, "icalendar is not supported for Python 3.2")
def test_ical_unicode(self): def test_ical_unicode(self):
todolist = load_file_to_todolist("test/data/ListCommandUnicodeTest.txt") todolist = load_file_to_todolist("test/data/ListCommandUnicodeTest.txt")
......
...@@ -40,9 +40,6 @@ class ListCommand(ExpressionCommand): ...@@ -40,9 +40,6 @@ class ListCommand(ExpressionCommand):
""" """
Attempts to import the icalendar package. Returns True if it Attempts to import the icalendar package. Returns True if it
succeeds, otherwise False. succeeds, otherwise False.
Raises a SyntaxError when icalendar couldn't be imported (most likely
under Python 3.2.
""" """
try: try:
import icalendar as _ import icalendar as _
...@@ -50,8 +47,6 @@ class ListCommand(ExpressionCommand): ...@@ -50,8 +47,6 @@ class ListCommand(ExpressionCommand):
self.error("icalendar package is not installed.") self.error("icalendar package is not installed.")
return False return False
# may also raise SyntaxError, but we'll deal with that in execute()
return True return True
def _process_flags(self): def _process_flags(self):
......
...@@ -69,10 +69,7 @@ class IcalPrinter(Printer): ...@@ -69,10 +69,7 @@ class IcalPrinter(Printer):
try: try:
import icalendar import icalendar
self.icalendar = icalendar self.icalendar = icalendar
except (SyntaxError, ImportError): # pragma: no cover except ImportError: # pragma: no cover
# icalendar does not support Python 3.2 resulting in a SyntaxError. Since
# this is an optional dependency, dropping Python 3.2 support altogether is
# too much. Therefore just disable the iCalendar functionality
self.icalendar = None self.icalendar = None
def print_list(self, p_todos): def print_list(self, p_todos):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment