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

nosetest -> pytest #1417

Merged
merged 2 commits into from
Apr 26, 2019
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: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[report]
include =
core/dbt/*
plugins/adapters/dbt/*
plugins/*/dbt/*
5 changes: 3 additions & 2 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
freezegun==0.3.9
nose>=1.3.7
pytest==4.4.0
pytest-cov==2.6.1
mock>=1.3.0
flake8>=3.5.0
pytz==2017.2
bumpversion==0.5.3
coverage==4.2
coverage==4.4
tox==2.5.0
ipdb
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
build:
context: .
dockerfile: Dockerfile
command: "/root/.virtualenvs/dbt/bin/nosetests"
command: "/root/.virtualenvs/dbt/bin/pytest"
env_file:
- ./test.env
volumes:
Expand Down
1 change: 0 additions & 1 deletion test/integration/001_simple_copy_test/test_simple_copy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest, use_profile


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile


class TestSimpleSeedColumnOverride(DBTIntegrationTest):
Expand Down Expand Up @@ -40,7 +39,7 @@ def seed_types(self):
"birthday": "date",
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed_with_column_override_postgres(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand All @@ -63,7 +62,7 @@ def seed_types(self):
def profile_config(self):
return self.snowflake_profile()

@attr(type='snowflake')
@use_profile('snowflake')
def test_simple_seed_with_column_override_snowflake(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand All @@ -86,7 +85,7 @@ def seed_types(self):
def profile_config(self):
return self.bigquery_profile()

@attr(type='bigquery')
@use_profile('bigquery')
def test_simple_seed_with_column_override_bigquery(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand Down
15 changes: 7 additions & 8 deletions test/integration/005_simple_seed_test/test_simple_seed.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile

from dbt.exceptions import CompilationException

Expand All @@ -24,7 +23,7 @@ def project_config(self):
"data-paths": ['test/integration/005_simple_seed_test/data']
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand All @@ -37,7 +36,7 @@ def test_simple_seed(self):
self.assertTablesEqual("seed_actual","seed_expected")


@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed_with_drop(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand Down Expand Up @@ -72,7 +71,7 @@ def project_config(self):
}
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed_with_schema(self):
schema_name = "{}_{}".format(self.unique_schema(), 'custom_schema')

Expand All @@ -86,7 +85,7 @@ def test_simple_seed_with_schema(self):
self.assertTablesEqual("seed_actual","seed_expected", table_a_schema=schema_name)


@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed_with_drop_and_schema(self):
schema_name = "{}_{}".format(self.unique_schema(), 'custom_schema')

Expand Down Expand Up @@ -126,7 +125,7 @@ def project_config(self):
}
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_seed_with_disabled(self):
results = self.run_dbt(["seed"])
self.assertEqual(len(results), 1)
Expand All @@ -153,7 +152,7 @@ def project_config(self):
"data-paths": ['test/integration/005_simple_seed_test/data-bad']
}

@attr(type='postgres')
@use_profile('postgres')
def test_postgres_dbt_run_skips_seeds(self):
# run does not try to parse the seed files
self.assertEqual(len(self.run_dbt(['run'])), 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile
import mock

import dbt.semver
Expand Down Expand Up @@ -32,7 +31,7 @@ def base_schema(self):
def configured_schema(self):
return self.unique_schema() + '_configured'

@attr(type='postgres')
@use_profile('postgres')
def test_postgres_local_dependency(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run"])
Expand Down Expand Up @@ -62,7 +61,7 @@ def base_schema(self):
def configured_schema(self):
return 'configured_{}_macro'.format(self.unique_schema())

@attr(type='postgres')
@use_profile('postgres')
@mock.patch('dbt.config.project.get_installed_version')
def test_postgres_local_dependency_out_of_date(self, mock_get):
mock_get.return_value = dbt.semver.VersionSpecifier.from_version_string('0.0.1')
Expand All @@ -71,7 +70,7 @@ def test_postgres_local_dependency_out_of_date(self, mock_get):
self.run_dbt(['run'])
self.assertIn('--no-version-check', str(exc.exception))

@attr(type='postgres')
@use_profile('postgres')
@mock.patch('dbt.config.project.get_installed_version')
def test_postgres_local_dependency_out_of_date_no_check(self, mock_get):
mock_get.return_value = dbt.semver.VersionSpecifier.from_version_string('0.0.1')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile

class TestSimpleDependency(DBTIntegrationTest):

Expand All @@ -25,7 +24,7 @@ def packages_config(self):
]
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run"])
Expand All @@ -47,7 +46,7 @@ def test_simple_dependency(self):
self.assertTablesEqual("seed","view_model")
self.assertTablesEqual("seed","incremental")

@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency_with_models(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run", '--models', 'view_model+'])
Expand Down Expand Up @@ -105,7 +104,7 @@ def deps_run_assert_equality(self):
self.assertEqual(created_models['view_summary'], 'view')
self.assertEqual(created_models['incremental'], 'table')

@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.deps_run_assert_equality()

Expand All @@ -115,7 +114,7 @@ def test_simple_dependency(self):

self.deps_run_assert_equality()

@attr(type='postgres')
@use_profile('postgres')
def test_empty_models_not_compiled_in_dependencies(self):
self.deps_run_assert_equality()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile

class BaseTestSimpleDependencyWithConfigs(DBTIntegrationTest):

Expand Down Expand Up @@ -40,7 +39,7 @@ def project_config(self):
},
}

@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run"])
Expand Down Expand Up @@ -83,7 +82,7 @@ def project_config(self):
}


@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run"])
Expand Down Expand Up @@ -127,7 +126,7 @@ def project_config(self):
}


@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.use_default_project()

Expand Down Expand Up @@ -183,7 +182,7 @@ def project_config(self):
}


@attr(type='postgres')
@use_profile('postgres')
def test_simple_dependency(self):
self.run_dbt(["deps"])
results = self.run_dbt(["run"])
Expand Down
31 changes: 15 additions & 16 deletions test/integration/007_graph_selection_tests/test_graph_selection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
from test.integration.base import DBTIntegrationTest, use_profile

class TestGraphSelection(DBTIntegrationTest):

Expand All @@ -26,7 +25,7 @@ def assert_correct_schemas(self):
)
self.assertFalse(exists)

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__specific_model(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -40,7 +39,7 @@ def test__postgres__specific_model(self):
self.assertFalse('emails' in created_models)
self.assert_correct_schemas()

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__tags(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -54,7 +53,7 @@ def test__postgres__tags(self):
self.assertTrue('users_rollup' in created_models)
self.assert_correct_schemas()

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__tags_and_children(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -69,7 +68,7 @@ def test__postgres__tags_and_children(self):
self.assertTrue('users' in created_models)
self.assert_correct_schemas()

@attr(type='snowflake')
@use_profile('snowflake')
def test__snowflake__specific_model(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -83,7 +82,7 @@ def test__snowflake__specific_model(self):
self.assertFalse('EMAILS' in created_models)
self.assert_correct_schemas()

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__specific_model_and_children(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -98,7 +97,7 @@ def test__postgres__specific_model_and_children(self):
self.assertNotIn('emails', created_models)
self.assert_correct_schemas()

@attr(type='snowflake')
@use_profile('snowflake')
def test__snowflake__specific_model_and_children(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -114,7 +113,7 @@ def test__snowflake__specific_model_and_children(self):
self.assertFalse('EMAILS' in created_models)


@attr(type='postgres')
@use_profile('postgres')
def test__postgres__specific_model_and_parents(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -128,7 +127,7 @@ def test__postgres__specific_model_and_parents(self):
self.assertFalse('emails' in created_models)
self.assert_correct_schemas()

@attr(type='snowflake')
@use_profile('snowflake')
def test__snowflake__specific_model_and_parents(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -145,7 +144,7 @@ def test__snowflake__specific_model_and_parents(self):
self.assertFalse('EMAILS' in created_models)


@attr(type='postgres')
@use_profile('postgres')
def test__postgres__specific_model_with_exclusion(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -161,7 +160,7 @@ def test__postgres__specific_model_with_exclusion(self):
self.assertFalse('emails' in created_models)
self.assert_correct_schemas()

@attr(type='snowflake')
@use_profile('snowflake')
def test__snowflake__specific_model_with_exclusion(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")

Expand All @@ -176,7 +175,7 @@ def test__snowflake__specific_model_with_exclusion(self):
self.assertFalse('USERS_ROLLUP' in created_models)
self.assertFalse('EMAILS' in created_models)

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__locally_qualified_name(self):
results = self.run_dbt(['run', '--models', 'test.subdir'])
self.assertEqual(len(results), 2)
Expand All @@ -189,7 +188,7 @@ def test__postgres__locally_qualified_name(self):
self.assertIn('nested_users', created_models)
self.assert_correct_schemas()

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__childrens_parents(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")
results = self.run_dbt(['run', '--models', '@base_users'])
Expand All @@ -202,7 +201,7 @@ def test__postgres__childrens_parents(self):
self.assertNotIn('subdir', created_models)
self.assertNotIn('nested_users', created_models)

@attr(type='postgres')
@use_profile('postgres')
def test__postgres__more_childrens_parents(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")
results = self.run_dbt(['run', '--models', '@users'])
Expand All @@ -216,7 +215,7 @@ def test__postgres__more_childrens_parents(self):
self.assertNotIn('subdir', created_models)
self.assertNotIn('nested_users', created_models)

@attr(type='snowflake')
@use_profile('snowflake')
def test__snowflake__skip_intermediate(self):
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")
results = self.run_dbt(['run', '--models', '@users'])
Expand Down
Loading