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

swap back to __version__.py #3

Merged
merged 6 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Rather than forking `dbt-labs/dbt-postgres`, use `dbt-labs/dbt-postgres` directl
[Setting up an environment](https://github.com/dbt-labs/dbt-core/blob/HEAD/CONTRIBUTING.md#setting-up-an-environment)
3. Install `dbt-postgres` and development dependencies in the virtual environment
```shell
pip install -e .[dev]
pip install -e "".[dev]""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double double quotes doesn't look right here.

```

When `dbt-postgres` is installed this way, any changes made to the `dbt-postgres` source code
Expand All @@ -86,6 +86,8 @@ will be reflected in the virtual environment immediately.
`dbt-postgres` contains [unit](https://github.com/dbt-labs/dbt-postgres/tree/main/tests/unit)
and [functional](https://github.com/dbt-labs/dbt-postgres/tree/main/tests/functional) tests.

To install test dependencies run: `pip install -e ".[test]"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to specifically not advertise that you could do this, and provide instructions just for hatch. Obviously that didn't happen at all here, but I don't think we should add this. Whether it's in this PR, or a separate docs one, we should update this file to be hatch-centric.


### Unit tests

Unit tests can be run locally without setting up a database connection:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ include = ["dbt"]
packages = ["dbt"]

[tool.hatch.version]
path = "dbt/adapters/postgres/__about__.py"
path = "dbt/adapters/postgres/__version__.py"

[tool.hatch.envs.default]
features = [
Expand Down
55 changes: 55 additions & 0 deletions tests/functional/dbt_debug/test_dbt_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import pytest
import os
import re
import yaml

from tests.functional.utils import run_dbt, run_dbt_and_capture

MODELS__MODEL_SQL = """
seled 1 as id
"""


class BaseDebug:
@pytest.fixture(scope="class")
def models(self):
return {"model.sql": MODELS__MODEL_SQL}

@pytest.fixture(autouse=True)
def capsys(self, capsys):
self.capsys = capsys

def assertGotValue(self, linepat, result):
colin-rogers-dbt marked this conversation as resolved.
Show resolved Hide resolved
found = False
output = self.capsys.readouterr().out
for line in output.split("\n"):
if linepat.match(line):
found = True
assert result in line
if not found:
with pytest.raises(Exception) as exc:
msg = f"linepat {linepat} not found in stdout: {output}"
assert msg in str(exc.value)

def check_project(self, splitout, msg="ERROR invalid"):
for line in splitout:
if line.strip().startswith("dbt_project.yml file"):
assert msg in line
elif line.strip().startswith("profiles.yml file"):
assert "ERROR invalid" not in line


class BaseDebugProfileVariable(BaseDebug):
@pytest.fixture(scope="class")
def project_config_update(self):
return {"config-version": 2, "profile": '{{ "te" ~ "st" }}'}


class TestDebugPostgres(BaseDebug):
def test_ok(self, project):
result, log = run_dbt_and_capture(["debug"])
assert "ERROR" not in log


class TestDebugProfileVariablePostgres(BaseDebugProfileVariable):
pass
Loading