Skip to content

Use dbt test queries in place of pytest - #20

Open
log-head wants to merge 1 commit into
mainfrom
lougheed/dbt_tests
Open

Use dbt test queries in place of pytest#20
log-head wants to merge 1 commit into
mainfrom
lougheed/dbt_tests

Conversation

@log-head

Copy link
Copy Markdown
Collaborator

Moving the existing pytest tests to queries for using with dbt test.

@log-head
log-head requested review from combscCode and sfrison March 17, 2025 19:38
@log-head log-head self-assigned this Mar 17, 2025

@combscCode combscCode left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approving, a couple of comments to address in here but I trust you to address those then merge the code in! Thanks for this!

Feel free to ping me again on this if you want me to double check your changes if you're unsure.

Comment on lines +22 to +43
/*
WITH expected_results AS (
SELECT TIMESTAMP '2023-11-22 02:00:00' AS begin,
TIMESTAMP '2023-11-22 04:00:00' AS stop,
'a' AS cce_id
UNION ALL
SELECT TIMESTAMP '2023-11-22 04:30:00',
CAST(NULL AS TIMESTAMP),
'a'
UNION ALL
SELECT TIMESTAMP '2023-11-22 02:00:00',
TIMESTAMP '2023-11-22 04:00:00',
'b'
)
SELECT actual.*
FROM public.freeze_fridge_alarms actual
LEFT JOIN expected_results expected
ON actual.begin = expected.begin
AND actual.stop IS NOT DISTINCT FROM expected.stop
AND actual.cce_id = expected.cce_id
WHERE expected.begin IS NULL
*/ No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm is this a window into your development process? ;)

Please remove this!

Comment thread Makefile
./load/load_csvs.sh
dbt build
pytest tests
dbt test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

awesome!!! Could you also remove pytest dependencies in the Dockerfile + requirements.txt?

Comment on lines +1 to +3
SELECT *
FROM {{ ref('heat_fridge_alarms') }}
LIMIT 1 No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question for my understanding: Is this test basically asserting that heat fridge alarms aren't created for our test data?

@combscCode

Copy link
Copy Markdown
Collaborator

oh also make sure to pass the linter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants