Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/test utils #795

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docs/website/docs/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import os
import pytest
from typing import List
from unittest.mock import patch

from dlt.common.utils import set_working_dir
from dlt.common.configuration.container import Container

# patch which providers to enable
from dlt.common.configuration.providers import StringTomlProvider, EnvironProvider, SecretsTomlProvider, ConfigTomlProvider
from dlt.common.configuration.specs.config_providers_context import ConfigProvidersContext, ConfigProvidersConfiguration

from tests.utils import patch_home_dir, autouse_test_storage, preserve_environ, duckdb_pipeline_location, wipe_pipeline
from dlt.common.configuration.providers import EnvironProvider, SecretsTomlProvider, ConfigTomlProvider
AstrakhantsevaAA marked this conversation as resolved.
Show resolved Hide resolved
from dlt.common.configuration.specs.config_providers_context import ConfigProvidersContext


@pytest.fixture(autouse=True)
Expand All @@ -30,7 +27,6 @@ def _initial_providers():
yield



def pytest_configure(config):
# push sentry to ci
os.environ["RUNTIME__SENTRY_DSN"] = "https://[email protected]/4504819859914752"
28 changes: 15 additions & 13 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,21 @@ def skip_if_not_active(destination: str) -> None:


def is_running_in_github_fork() -> bool:
event_path = os.environ["GITHUB_EVENT_PATH"]

# Extract necessary information from the GitHub Actions event payload
with open(event_path, encoding="utf-8") as f:
event_data = dlt.common.json.load(f)

# Check if the pull request is from a fork
is_pull_request_from_fork = (
event_data.get("pull_request", {})
.get("head", {})
.get("repo", {})
.get("fork", False)
)
event_path = os.environ.get("GITHUB_EVENT_PATH")
is_pull_request_from_fork = False

if event_path:
# Extract necessary information from the GitHub Actions event payload
with open(event_path, encoding="utf-8") as f:
event_data = dlt.common.json.load(f)

# Check if the pull request is from a fork
is_pull_request_from_fork = (
event_data.get("pull_request", {})
.get("head", {})
.get("repo", {})
.get("fork", False)
)

return is_pull_request_from_fork

Expand Down
Loading