We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
filename_for_module
1 parent 202caa3 commit e4ccac4Copy full SHA for e4ccac4
tests/utils/test_general.py
@@ -74,13 +74,26 @@ def test_filename():
74
75
assert x("bogus", "bogus") == "bogus"
76
77
+ assert x("bogus", "bogus.pyc") == "bogus.py"
78
+
79
assert x("os", os.__file__) == "os.py"
80
81
+ assert x("foo.bar", "path/to/foo/bar.py") == "path/to/foo/bar.py"
82
83
import sentry_sdk.utils
84
85
assert x("sentry_sdk.utils", sentry_sdk.utils.__file__) == "sentry_sdk/utils.py"
86
87
88
+def test_filename_module_file_is_none():
89
+ class DummyModule:
90
+ __file__ = None
91
92
+ os.sys.modules["foo"] = DummyModule()
93
94
+ assert filename_for_module("foo.bar", "path/to/foo/bar.py") == "path/to/foo/bar.py"
95
96
97
@pytest.mark.parametrize(
98
"given,expected_envelope",
99
[
0 commit comments