hedyhli/starcli

Add CLI tests (pytest) to test the CLI itself

hedyhli opened this issue ยท 7 comments

Currently we only have a search() test (you can check out the tests dir), we probably need a way to emulate a real terminal and call it from that command line (With different options) to test the full functionality, can use: https://click.palletsprojects.com/en/7.x/testing/

Just add some test_*.py files in tests/ and in it add test_* functions to do your test. Then you can run python -m pytest and make sure they pass. We need these because they are part of the GitHub action workflow, all pull request and pushed commits will then be tested using it

Hi there,

I'd like to take on this issue if that's okay?

@Chalmiller Sure, of course it's okay :)

Just found this: https://click.palletsprojects.com/en/7.x/testing/
We can use that for testing CLI ๐Ÿ‘๐Ÿป

Hi @Chalmiller, are you still working on this? Are you using the Click testing as @hedythedev suggested? I'd like to work on this issue as well.

Looks like @Chalmiller hasn't responded or forked, I'll add you instead @jSadoski ๐Ÿ˜‰

So I've implemented a basic testing suite based on click.testing which tests every parameter and passes. The issue I'm having now, however, is hitting the rate limits as described in #61 on just my test file alone, not to mention when running all the tests. Running each test independently works, just not one right after the other.

The key indicator of this problem is when

https://github.com/hedythedev/starcli/blob/0e9da5fe73b78b6dd4ffd8b465011b22806624ad/starcli/search.py#L133

returns <Result KeyError('items')>

Short of building in a delay if this error occurs, I'm not sure what to do about it until #61 is resolved.

Not sure if it's possible to add API keys so we have a higher rate limit