Skip to content

Commit

Permalink
Make Python 3.4 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon committed Oct 31, 2017
1 parent d7e6df3 commit 71a5fe3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions importlib_resources/tests/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import abc
import importlib
import importlib.machinery
import importlib.util
import io
import pathlib
import sys
import types
import unittest

from .. import abc as resources_abc
Expand All @@ -27,10 +27,15 @@ def resource_path(self, path_):
else:
return path

spec = importlib.machinery.ModuleSpec('testingpackage', Reader(),
name = 'testingpackage'
spec = importlib.machinery.ModuleSpec(name, Reader(),
origin='does-not-exist',
is_package=True)
return importlib.util.module_from_spec(spec)
# Unforunately importlib.util.module_from_spec() was not introduced until
# Python 3.5.
module = types.ModuleType(name)
module.__spec__ = spec
return module


class CommonTests(abc.ABC):
Expand Down

0 comments on commit 71a5fe3

Please sign in to comment.