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

converting 023_exit_codes_tests #6105

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions test/integration/023_exit_codes_tests/models/bad.sql

This file was deleted.

8 changes: 0 additions & 8 deletions test/integration/023_exit_codes_tests/models/dupe.sql

This file was deleted.

8 changes: 0 additions & 8 deletions test/integration/023_exit_codes_tests/models/good.sql

This file was deleted.

17 changes: 0 additions & 17 deletions test/integration/023_exit_codes_tests/models/schema.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/integration/023_exit_codes_tests/seeds-bad/data.csv

This file was deleted.

2 changes: 0 additions & 2 deletions test/integration/023_exit_codes_tests/seeds-good/data.csv

This file was deleted.

4 changes: 0 additions & 4 deletions test/integration/023_exit_codes_tests/snapshots-bad/b.sql

This file was deleted.

4 changes: 0 additions & 4 deletions test/integration/023_exit_codes_tests/snapshots-good/g.sql

This file was deleted.

200 changes: 0 additions & 200 deletions test/integration/023_exit_codes_tests/test_exit_codes.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/CONVERTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* some of the legacy tests used a 'default_project' method to change (for example)
the seeds directory to load a different seed. Don't do that. Copying a file is
probably a better option.

* If there are more than 50 lines of fixture strings, they should be defined in a fixtures.py and then imported. We definitely don't do this everywhere right now but should move to this model.

# Integration test directories that have been converted
* 001\_simple\_copy\_tests => moved to 'basic'
Expand Down
78 changes: 78 additions & 0 deletions tests/functional/exit_codes/fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import pytest

bad_sql = """
select bad sql here
"""

dupe_sql = """
select 1 as id, current_date as updated_at
union all
select 2 as id, current_date as updated_at
union all
select 3 as id, current_date as updated_at
union all
select 4 as id, current_date as updated_at
"""

good_sql = """
select 1 as id, current_date as updated_at
union all
select 2 as id, current_date as updated_at
union all
select 3 as id, current_date as updated_at
union all
select 4 as id, current_date as updated_at
"""

snapshots_good_sql = """
{% snapshot good_snapshot %}
{{ config(target_schema=schema, target_database=database, strategy='timestamp', unique_key='id', updated_at='updated_at')}}
select * from {{ schema }}.good
{% endsnapshot %}
"""

snapshots_bad_sql = """
{% snapshot good_snapshot %}
{{ config(target_schema=schema, target_database=database, strategy='timestamp', unique_key='id', updated_at='updated_at_not_real')}}
select * from {{ schema }}.good
{% endsnapshot %}
"""

schema_yml = """
version: 2
models:
- name: good
columns:
- name: updated_at
tests:
- not_null
- name: bad
columns:
- name: updated_at
tests:
- not_null
- name: dupe
columns:
- name: updated_at
tests:
- unique
"""

data_seed_good_csv = """a,b,c
1,2,3
"""

data_seed_bad_csv = """a,b,c
1,\2,3,a,a,a
"""


class BaseConfigProject:
@pytest.fixture(scope="class")
def models(self):
return {
"bad.sql": bad_sql,
"dupe.sql": dupe_sql,
"good.sql": good_sql,
"schema.yml": schema_yml
}
Loading