This commit is contained in:
Anna Scholtz 2020-10-06 16:05:01 -07:00
Родитель 67c5265b6f
Коммит a84838466e
4 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -42,7 +42,7 @@ def sql_for_dry_run(file, parsed_routines, project_dir):
for udf, raw_routine in parsed_routines.items():
if udf in example_sql:
query = "".join(raw_routine.definitions)
dry_run_sql += sub_local_routines(query, parsed_routines)
dry_run_sql += sub_local_routines(query, project_dir, parsed_routines)
dry_run_sql += example_sql

Просмотреть файл

@ -67,6 +67,9 @@ class SqlTest(pytest.Item, pytest.File):
test_name = self.fspath.basename
query_name = self.fspath.dirpath().basename
dataset_name = self.fspath.dirpath().dirpath().basename
project_dir = (
self.fspath.dirpath().dirpath().dirpath().dirname.replace("tests", "")
)
init_test = False
script_test = False
@ -133,7 +136,8 @@ class SqlTest(pytest.Item, pytest.File):
views[table_name] = read(self.fspath.strpath, resource)
# rewrite all udfs as temporary
query = parse_routine.sub_local_routines(query)
query = parse_routine.sub_local_routines(query, project_dir)
print(query)
dataset_id = "_".join(self.fspath.strpath.split(os.path.sep)[-3:])
if "CIRCLE_BUILD_NUM" in os.environ:

Просмотреть файл

@ -5,7 +5,7 @@ from bigquery_etl.routine import parse_routine
TEST_DIR = Path(__file__).parent.parent
class TestParseUdf:
class TestParseRoutine:
udf_dir = TEST_DIR / "data" / "test_sql" / "moz-fx-data-test-project" / "udf"
def test_raw_routine_from_file(self):

Просмотреть файл

@ -7,7 +7,7 @@ from bigquery_etl.routine import parse_routine, publish_routines
TEST_DIR = Path(__file__).parent.parent
class TestPublishUdfs:
class TestPublishRoutine:
udf_dir = TEST_DIR / "data" / "test_sql" / "moz-fx-data-test-project" / "udf"
@mock.patch("google.cloud.bigquery.Client")