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

remove buggy and redundant test #1455

Merged
merged 3 commits into from
Sep 5, 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
9 changes: 0 additions & 9 deletions tests/testthat/_snaps/learn.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'public') and get_src_tbl_names() works?

Code
dm_from_con(con_db)[integer()]
Message
Keys queried successfully, use `learn_keys = TRUE` to mute this message.
Output
dm()

# dm_meta() contents

Code
Expand Down
43 changes: 0 additions & 43 deletions tests/testthat/test-learn.R
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
# FIXME: #313: learn only from current source

test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'public') and get_src_tbl_names() works?", {
skip_if_schema_not_supported()

# dm_learn_from_mssql() --------------------------------------------------
con_db <- my_test_con()

# create an object on the MSSQL-DB that can be learned
withr::defer(
try(walk(
remote_tbl_names,
~ try(dbExecute(con_db, paste0("DROP TABLE ", .x)))
))
)

dm_for_filter_copied <- copy_dm_to(con_db, dm_for_filter(), temporary = FALSE, table_names = ~ DBI::SQL(unique_db_table_name(.x)))
order_of_deletion <- c("tf_2", "tf_1", "tf_5", "tf_6", "tf_4", "tf_3")

remote_tbl_names <-
map_chr(
dm_get_tables(dm_for_filter_copied)[order_of_deletion],
dbplyr::remote_name
) %>%
SQL() %>%
DBI::dbUnquoteIdentifier(conn = con_db) %>%
map_chr(~ .x@name[["table"]])

remote_tbl_map <- set_names(remote_tbl_names, gsub("^(tf_.).*$", "\\1", remote_tbl_names))

# test 'get_src_tbl_names()'
src_tbl_names <- sort(unname(gsub("^.*\\.", "", get_src_tbl_names(con_db))))
expect_identical(
# fail if there are other tables in the default schema
src_tbl_names[grep("tf_._", src_tbl_names)],
sort(dbQuoteIdentifier(con_db, remote_tbl_names))
)

expect_snapshot({
dm_from_con(con_db)[integer()]
})
})

test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'public') and get_src_tbl_names() works?", {
skip_if_schema_not_supported()

Expand Down