Skip to content

Commit

Permalink
Merge pull request #171 from bear/Issue169
Browse files Browse the repository at this point in the history
Add import exception for unittest2 when run under Python 2.6 -- fixes Issue #169
  • Loading branch information
bear authored Jul 30, 2016
2 parents 0868aab + 0f8ce6d commit 2e78a58
Show file tree
Hide file tree
Showing 28 changed files with 160 additions and 68 deletions.
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ lint:
test: lint
python setup.py test

tox: clean
tox

coverage: clean
@coverage run --source=parsedatetime setup.py test
@coverage html
@coverage report

ci: info coverage
ci: tox coverage
CODECOV_TOKEN=`cat .codecov-token` codecov

build: clean
Expand Down
18 changes: 12 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ parsedatetime

Parse human-readable date/time strings.

Python 2.7 or greater is required for parsedatetime version 1.0 or greater.
Python 2.6 or greater is required for parsedatetime version 1.0 or greater.

While we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6

.. image:: https://img.shields.io/pypi/v/parsedatetime.svg
:target: https://pypi.python.org/pypi/parsedatetime/
Expand Down Expand Up @@ -40,17 +42,21 @@ From the source directory::

make test

To run tests on several python versions, type ``tox``::
To run tests on several python versions, type ``make tox``::

$ tox
$ make tox
[... tox creates a virtualenv for every python version and runs tests inside of each]
py27: commands succeeded
py35: commands succeeded

This assumes that you have ``python2.7``, ``python3.5``, etc in ``PATH`` or if your using
PyEnv then you need to run::
This assumes that you have the versions you want to test under installed as part of your
PyEnv environment::

pyenv local 2.6.6 2.7.10 3.5.0
pyenv install -s 2.6.9
pyenv install -s 2.7.11
pyenv install -s 3.5.2
pyenv install -s pypy-5.3
pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3

The tests depend on PyICU being installed. PyICU depends on icu4c which on OS X requires homebrew::

Expand Down
10 changes: 8 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
machine:
python:
version: 2.7.10
pre:
- pyenv install -s 2.6.9
- pyenv install -s 2.7.11
- pyenv install -s 3.5.2
- pyenv install -s pypy-5.3
post:
- pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3

dependencies:
override:
- pip install -U pip
- pip install tox
- make dev

test:
Expand Down
1 change: 1 addition & 0 deletions requirements.testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ coverage
coveralls
codecov
check-manifest
unittest2
8 changes: 6 additions & 2 deletions tests/TestAlternativeAbbreviations.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import sys
import time
import datetime
import parsedatetime as pdt
from parsedatetime.pdt_locales import get_icu

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


pdtLocale_en = get_icu('en_US')
pdtLocale_en.Weekdays = [
Expand Down
8 changes: 6 additions & 2 deletions tests/TestAustralianLocale.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import unittest
import sys
import time
import datetime
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestComplexDateTimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
from datetime import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
7 changes: 6 additions & 1 deletion tests/TestContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
Test pdtContext
"""

import sys
import time
import unittest
import parsedatetime as pdt
from parsedatetime.context import pdtContext

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
7 changes: 6 additions & 1 deletion tests/TestConvertUnitAsWords.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
Tests the _convertUnitAsWords method.
"""

import unittest
import sys
import parsedatetime as pdt

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):
def setUp(self):
Expand Down
7 changes: 6 additions & 1 deletion tests/TestDelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
Test time delta
"""

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


# added to support Python 2.6 which does not have total_seconds() method for timedelta
def total_seconds(timedelta):
Expand Down
8 changes: 6 additions & 2 deletions tests/TestErrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestFrenchLocale.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
Note: requires PyICU
"""
from __future__ import unicode_literals
import sys
import time
import datetime
import unittest
import parsedatetime as pdt
from parsedatetime.pdt_locales import get_icu

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestGermanLocale.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import unittest
import sys
import time
import datetime
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
7 changes: 6 additions & 1 deletion tests/TestInc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt
from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
9 changes: 7 additions & 2 deletions tests/TestLocaleBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
Note: requires PyICU
"""
from __future__ import unicode_literals
import sys
import time
import datetime
import unittest
import pytest
import parsedatetime as pdt
from parsedatetime.pdt_locales import get_icu

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


pdtLocale_fr = get_icu('fr_FR')
pdtLocale_fr.dayOffsets.update({"aujourd'hui": 0, 'demain': 1, 'hier': -1})

Expand Down
8 changes: 6 additions & 2 deletions tests/TestMultiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestNlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestPhrases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
8 changes: 6 additions & 2 deletions tests/TestRanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
from __future__ import unicode_literals

import sys
import time
import datetime
import unittest
import parsedatetime as pdt

from . import utils

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class test(unittest.TestCase):

Expand Down
Loading

0 comments on commit 2e78a58

Please sign in to comment.