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

Features request: expect_SQL, fixture organization #116

Open
ndiquattro opened this issue Jun 15, 2020 · 4 comments
Open

Features request: expect_SQL, fixture organization #116

ndiquattro opened this issue Jun 15, 2020 · 4 comments

Comments

@ndiquattro
Copy link

Not sure if you are taking feature requests or not, but I thought I'd give it a try.

  1. expect_SQL() - similar to expect_POST/GET in httptest. I find myself often just wanting to know if the end of a dbplyr chain or an internal function will produce the expected SQL, without much concern for response handling.

  2. Fixture organization - Perhaps there's already a best practice for this I'm not aware of, but I find I'm having a folder with a list of files that only differ by their hash. It makes it hard to update/change tests without slowly adding a bunch of defunct responses. Is there some way to add a label to the fixtures or organize them?

Thanks again for your work on this package!

@jonkeane
Copy link
Collaborator

jonkeane commented Jun 15, 2020

I am definitely open to feature requests.

The first one is something I've had on my mind but haven't gotten to yet. I'm glad to know that it's something you find that you want to do, that helps bump it up on my list of things to do with dittodb. I think I have a pretty good idea of how that would work and look, but when I have something more concrete I might tag you and ask for some feedback about the design of it if you don't mind.

The second one is not something I had thought about yet, but sounds like something that could very much be helpful. This is a bit clunky, but have you tried using with_mock_path() and creating separate folders for groups of fixtures? That should get you part of the way there (though I will admit it is definitely a bit clunky!). I'll think a bit more on this and see if there's something I could do to make this organization a bit easier.

Thanks for both of these!

@ndiquattro
Copy link
Author

I would be happy to provide feed back!

Ah, didn't know about with_mock_path(), seems like it would help. If possible, could be nice to have the schema/table architecture replicated in the folder structure of the fixtures. Would help narrow down the number of fixtures to inspect when looking for unused ones. Thanks!

@jonkeane
Copy link
Collaborator

jonkeane commented Oct 1, 2020

I've (finally!) gotten around to working on a minimal implementation of expect_sql(). I've got an implementation on a branch for now (expect-sql), would you be interested in trying it out and seeing if it works the way that you're expecting / do you have any feedback about it?

To install from the branch, you can remotes::install_github("ropensci/dittodb", ref = "expect-sql")

@ndiquattro
Copy link
Author

Excited to try this post-election! Sorry it's been so long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants