Skip to content

Commit 7a2f9c3

Browse files
AstrakhantsevaAAzem360burnash
authored
Fix/test utils (#795)
* check if GITHUB_EVENT_PATH key exists * del unused imports * Update docs/website/docs/conftest.py Co-authored-by: Anton Burnashev <anton.burnashev@gmail.com> * return unused imports back --------- Co-authored-by: Zaeem Athar <zaeemathar94@gmail.com> Co-authored-by: Anton Burnashev <anton.burnashev@gmail.com>
1 parent e573340 commit 7a2f9c3

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

docs/website/docs/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def _initial_providers():
3030
yield
3131

3232

33-
3433
def pytest_configure(config):
3534
# push sentry to ci
3635
os.environ["RUNTIME__SENTRY_DSN"] = "https://6f6f7b6f8e0f458a89be4187603b55fe@o1061158.ingest.sentry.io/4504819859914752"

tests/utils.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,21 @@ def skip_if_not_active(destination: str) -> None:
225225

226226

227227
def is_running_in_github_fork() -> bool:
228-
event_path = os.environ["GITHUB_EVENT_PATH"]
229-
230-
# Extract necessary information from the GitHub Actions event payload
231-
with open(event_path, encoding="utf-8") as f:
232-
event_data = dlt.common.json.load(f)
233-
234-
# Check if the pull request is from a fork
235-
is_pull_request_from_fork = (
236-
event_data.get("pull_request", {})
237-
.get("head", {})
238-
.get("repo", {})
239-
.get("fork", False)
240-
)
228+
event_path = os.environ.get("GITHUB_EVENT_PATH")
229+
is_pull_request_from_fork = False
230+
231+
if event_path:
232+
# Extract necessary information from the GitHub Actions event payload
233+
with open(event_path, encoding="utf-8") as f:
234+
event_data = dlt.common.json.load(f)
235+
236+
# Check if the pull request is from a fork
237+
is_pull_request_from_fork = (
238+
event_data.get("pull_request", {})
239+
.get("head", {})
240+
.get("repo", {})
241+
.get("fork", False)
242+
)
241243

242244
return is_pull_request_from_fork
243245

0 commit comments

Comments
 (0)