Skip to content

Commit

Permalink
Shim for FileNotFoundError in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Jul 21, 2016
1 parent 2210c4e commit cfee464
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gdx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from itertools import cycle
from logging import debug, info
# commented: for debugging
Expand Down
8 changes: 3 additions & 5 deletions gdx/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# coding: utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from os.path import dirname
import sys
from .pycompat import FileNotFoundError

PY3 = sys.version_info[0] >= 3

Expand All @@ -14,9 +15,6 @@
from future import standard_library
standard_library.install_aliases()

class FileNotFoundError(OSError):
pass

import gdxcc


Expand Down
11 changes: 11 additions & 0 deletions gdx/pycompat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

PY3 = sys.version_info[0] >= 3

if PY3:
from builtins import FileNotFoundError
else:
class FileNotFoundError(OSError):
pass

__all__ = ['FileNotFoundError']
3 changes: 2 additions & 1 deletion gdx/test/test_gdx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from collections import OrderedDict

import numpy as np
import pytest

import numpy as np
from gdx.pycompat import FileNotFoundError


@pytest.fixture(scope='session')
Expand Down

0 comments on commit cfee464

Please sign in to comment.