From 6ce9f197f4681875a2595a5a8d86bd047f993a99 Mon Sep 17 00:00:00 2001 From: David Medina Date: Thu, 1 Mar 2012 23:23:15 +0100 Subject: Python 2.6 compatibility --- pygithub3/tests/utils/core.py | 5 +++++ pygithub3/tests/utils/resources.py | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'pygithub3/tests/utils') diff --git a/pygithub3/tests/utils/core.py b/pygithub3/tests/utils/core.py index 8d18732..32170e4 100644 --- a/pygithub3/tests/utils/core.py +++ b/pygithub3/tests/utils/core.py @@ -1,6 +1,11 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- +try: + from unittest2 import TestCase # Python 2.6 +except ImportError: + from unittest import TestCase # Python >2.7 + from .base import Mock, DummyRequest request = DummyRequest() diff --git a/pygithub3/tests/utils/resources.py b/pygithub3/tests/utils/resources.py index d9e4975..be9245b 100644 --- a/pygithub3/tests/utils/resources.py +++ b/pygithub3/tests/utils/resources.py @@ -1,7 +1,14 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- +from mock import Mock + from .base import Resource +from pygithub3.resources.base import json +from pygithub3.tests.utils.base import mock_json + +json.dumps = Mock(side_effect=mock_json) +json.loads = Mock(side_effect=mock_json) class Simple(Resource): -- cgit v1.2.3-59-g8ed1b