Skip to content

Commit b65e3cf

Browse files
committed
feat: set project root in tests
1 parent 9a65922 commit b65e3cf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

posthog/exception_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,6 @@ def set_in_app_in_frames(frames, in_app_exclude, in_app_include, project_root=No
735735
frame["in_app"] = True
736736
continue
737737

738-
# handles case where user script directly runs other python script which is not in the project root
739-
if module == "__main__":
740-
frame["in_app"] = True
741-
continue
742-
743738
return frames
744739

745740

posthog/test/test_exception_capture.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_code_variables_capture(tmpdir):
3939
app.write(
4040
dedent(
4141
"""
42+
import os
4243
from posthog import Posthog
4344
4445
class UnserializableObject:
@@ -49,7 +50,8 @@ class UnserializableObject:
4950
host='https://eu.i.posthog.com',
5051
debug=True,
5152
enable_exception_autocapture=True,
52-
code_variables_enabled=True
53+
code_variables_enabled=True,
54+
project_root=os.path.dirname(os.path.abspath(__file__))
5355
)
5456
5557
def trigger_error():
@@ -113,6 +115,7 @@ def test_code_variables_context_override(tmpdir):
113115
app.write(
114116
dedent(
115117
"""
118+
import os
116119
import posthog
117120
from posthog import Posthog
118121
@@ -121,7 +124,8 @@ def test_code_variables_context_override(tmpdir):
121124
host='https://eu.i.posthog.com',
122125
debug=True,
123126
enable_exception_autocapture=True,
124-
code_variables_enabled=False
127+
code_variables_enabled=False,
128+
project_root=os.path.dirname(os.path.abspath(__file__))
125129
)
126130
127131
def process_data():

0 commit comments

Comments
 (0)