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

overwrite_missing_table spec should use iris_in instead of iris in dbWriteTable #210

Closed
martinstuder opened this issue Dec 11, 2020 · 4 comments

Comments

@martinstuder
Copy link

overwrite_table_missing = function(ctx, con, table_name) {
iris_in <- get_iris(ctx)
expect_error(
dbWriteTable(con, table_name, iris[1:10, ], overwrite = TRUE),

The call to dbWriteTable above should use iris_in instead of iris since the expect_equal_df call uses iris_in.

@krlmlr
Copy link
Member

krlmlr commented Dec 20, 2020

Thanks. What problems are you seeing with the current implementation?

@martinstuder
Copy link
Author

@krlmlr I was investigating a failure in that test case (overwrite_table_missing) that I thought was related to a difference between datasets::iris and the result of DBItest:::get_iris. It turns out the test case actually passes and the issue was a different one unrelated to DBItest. If I understand the test case correctly, it would still seem safer to use iris_in in case the definition of DBItest:::get_iris should change.

Partially related to that may be that DBItest:::get_iris currently includes an as.character conversion on Species that doesn't have any effect since it performs the conversion on a local copy of iris instead of datasets_iris:

iris$Species <- as.character(iris$Species)

@krlmlr
Copy link
Member

krlmlr commented Dec 21, 2020

Good catch, thanks!

This was referenced Dec 23, 2020
@krlmlr krlmlr closed this as completed in 26c2984 Dec 25, 2020
krlmlr added a commit that referenced this issue Dec 25, 2020
…ing_table

- Fix input dataset in `"overwrite_table_missing"` test (#210, @martinstuder).
krlmlr added a commit that referenced this issue Oct 31, 2021
DBItest 1.7.1

- Many tests now emit simpler stack traces, because the connection is opened by the test driver and not by the test itself (#187). Reduce usage of `with_remove_test_table()` for better stack traces on error (#196). Remove `with_*connection()` (#193).
- `test_some()` shows DBI code via dblog (#217) if `dblog = TRUE` (#226).
- New `"bind_date_integer"`, `"bind_time_seconds"` and `"bind_time_hours"` tests (#218).
- New `create_table_as` tweak (#131).
- `"roundtrip_time"` and `"append_roundtrip_time"` tests now also test values of class `"difftime"` with units other than `"secs"` (#199).
- All tables created by the tests have the `"dbit"` prefix. Almost all tests now use random table names to avoid collisions and unrelated test failures (#197).
- `"roundtrip_timestamp"` tests now accept a time zone set by the database backend (#178, #198).
- Support more than one class of each type in DBI backend packages.

- Fix input dataset in `"overwrite_table_missing"` test (#210, @martinstuder).
- Use original test name to decide if a test is skipped (#225).
- Fix reexport test: skip if package is not installed, remove checks for deprecated functions and functions not reexported (#203).

- Requires DBI 1.1.1.
- Test odbc as part of the backend tests (#228).
- Dynamic build matrix for backends (#221).
- Compatibility with testthat 3.0.0 (#207).
- Switch to GitHub Actions (#201).
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants