Skip to content

Commit afef2c1

Browse files
authored
Merge pull request #476 from jayvdb/no-__file__
Ignore missing __file__
2 parents 4cb8fb3 + e6d27a2 commit afef2c1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tlz/_build_tlz.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def exec_module(self, module):
6363
module.__doc__ = fast_mod.__doc__
6464

6565
# show file from toolz during introspection
66-
module.__file__ = slow_mod.__file__
66+
try:
67+
module.__file__ = slow_mod.__file__
68+
except AttributeError:
69+
pass
6770

6871
for k, v in fast_mod.__dict__.items():
6972
tv = slow_mod.__dict__.get(k)

toolz/tests/test_tlz.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ def test_tlz():
4646
except ImportError:
4747
pass
4848

49-
assert tlz.__file__ == toolz.__file__
50-
assert tlz.functoolz.__file__ == toolz.functoolz.__file__
49+
if hasattr(tlz, '__file__'):
50+
assert tlz.__file__ == toolz.__file__
51+
if hasattr(tlz.functoolz, '__file__'):
52+
assert tlz.functoolz.__file__ == toolz.functoolz.__file__
5153

5254
assert tlz.pipe is toolz.pipe
5355

0 commit comments

Comments
 (0)