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

[Backport 1.5.latest] Missed PR feedback #7642 #7649

Closed
Closed
Changes from all 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
22 changes: 22 additions & 0 deletions tests/functional/dependencies/test_local_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from pathlib import Path
from unittest import mock
from contextlib import contextmanager

import dbt.semver
import dbt.config
Expand All @@ -16,6 +17,7 @@
from dbt.tests.util import (
check_relations_equal,
run_dbt,
run_dbt_and_capture,
)

models__dep_source = """
Expand Down Expand Up @@ -85,6 +87,16 @@
"""


@contextmanager
def up_one():
current_path = Path.cwd()
os.chdir("../")
try:
yield
finally:
os.chdir(current_path)


class BaseDependencyTest(object):
@pytest.fixture(scope="class")
def macros(self):
Expand Down Expand Up @@ -174,6 +186,16 @@ def test_no_dependency_paths(self, project):
assert len(results) == 2


class TestSimpleDependencyRelativePath(BaseDependencyTest):
def test_local_dependency_relative_path(self, project):
last_dir = Path(project.project_root).name
with up_one():
_, stdout = run_dbt_and_capture(["deps", "--project-dir", last_dir])
assert (
"Installed from <local @ local_dependency>" in stdout
), "Test output didn't contain expected string"


class TestMissingDependency(object):
@pytest.fixture(scope="class")
def models(self):
Expand Down