-
Notifications
You must be signed in to change notification settings - Fork 20
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
Changes from 4 commits
0732783
0ff59dc
63ce9e2
d0fb9ed
e4b6919
08daa68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]"" | ||
``` | ||
|
||
When `dbt-postgres` is installed this way, any changes made to the `dbt-postgres` source code | ||
|
@@ -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]"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
### Unit tests | ||
|
||
Unit tests can be run locally without setting up a database connection: | ||
|
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 |
There was a problem hiding this comment.
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.