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

Make stub data accessible #44

Closed
jonnybazookatone opened this issue Jan 22, 2016 · 5 comments
Closed

Make stub data accessible #44

jonnybazookatone opened this issue Jan 22, 2016 · 5 comments

Comments

@jonnybazookatone
Copy link
Collaborator

There are some stub data for both expected SolrQuery and MetricsQuery, in the repository. It'd be useful to have them accessible via the import.

eg.,

from ads.tests import solr_stub_data

The context being that we have a lot of users testing on the API directly and hitting their API rate limit, rather than using the stub data you've got available in the package.

@vsudilov
Copy link
Collaborator

Hi,

Could you give a bit more specifics on the functionality you propose? Are you saying that you want the ability to use a different backend to the client? i.e., something like sq = TestingSearchQuery() ?

@jonnybazookatone
Copy link
Collaborator Author

More simple, can I import for example, MockSolrResponse, https://github.com/andycasey/ads/blob/master/ads/tests/mocks.py#L50, and use for testing my app, rather than hitting the API.

As far as I can tell, you can't access it when installed via pip atm:

In [1]: import ads

In [2]: from ads.
ads.base        ads.config      ads.exceptions  ads.export      ads.libraries   ads.metrics     ads.search

@vsudilov
Copy link
Collaborator

To use MockSolrResponse, one would have to understand to use that as a context-manager that intercepts http requests, which makes me question if its users or developers that need this functionality.

If we want this feature to be user-facing, I think we can come up with a simpler API/workflow to implement that functionality, but I'd need to understand more details of those use cases. If its for developers, then I think adding it to the package-level __init__.py will be sufficient.

Thoughts?

@jonnybazookatone
Copy link
Collaborator Author

I'm still split. I feel there will be some people who would want to work explicitly with the context-manager, and some people who want to treat it as a magic box, with a flag such as 'dry_run', without having to understand the underlying machinery.

So, for now I'd just add the __init__.py at the package level, given it's the fastest/easiest, and most flexible at this point. But as some stage, it would be nice to make this part of the API for those users that don't need (or want) to understand, and just want it to work without using their API rate limit.

I'm open to other suggestions though, my feelings may be biased.

@jonnybazookatone
Copy link
Collaborator Author

This can be closed if #53 is merged.

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