diff --git a/tlz/_build_tlz.py b/tlz/_build_tlz.py index 3c017a54..f29eed1b 100644 --- a/tlz/_build_tlz.py +++ b/tlz/_build_tlz.py @@ -63,7 +63,10 @@ def exec_module(self, module): module.__doc__ = fast_mod.__doc__ # show file from toolz during introspection - module.__file__ = slow_mod.__file__ + try: + module.__file__ = slow_mod.__file__ + except AttributeError: + pass for k, v in fast_mod.__dict__.items(): tv = slow_mod.__dict__.get(k) diff --git a/toolz/tests/test_tlz.py b/toolz/tests/test_tlz.py index ed2646a8..c449f607 100644 --- a/toolz/tests/test_tlz.py +++ b/toolz/tests/test_tlz.py @@ -46,8 +46,10 @@ def test_tlz(): except ImportError: pass - assert tlz.__file__ == toolz.__file__ - assert tlz.functoolz.__file__ == toolz.functoolz.__file__ + if hasattr(tlz, '__file__'): + assert tlz.__file__ == toolz.__file__ + if hasattr(tlz.functoolz, '__file__'): + assert tlz.functoolz.__file__ == toolz.functoolz.__file__ assert tlz.pipe is toolz.pipe