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

Use Betamax to implement tests #11

Open
jcfr opened this issue Feb 18, 2017 · 2 comments
Open

Use Betamax to implement tests #11

jcfr opened this issue Feb 18, 2017 · 2 comments

Comments

@jcfr
Copy link
Collaborator

jcfr commented Feb 18, 2017

The plan is to leverage tools like betamax allowing to intercept every request made and attempting to find a matching request that has already been intercepted and recorded.

See http://betamax.readthedocs.io/

@jcfr
Copy link
Collaborator Author

jcfr commented Mar 27, 2018

@Pierre-Assemat : When you have a chance, let me know what would you suggest to improve the testing.

@Pierre-Assemat
Copy link

In Slicer Package Manager PR we use pytest-vcr to intercepted and recorded the server responses.

It works well and is very easy to use. Just by adding the decorator @pytest.mark.vcr() on top of each one of your test you'd like to record the server responses, like for instance:

@pytest.mark.vcr()
def test_main():
    import github_release as ghr
    with pytest.raises(SystemExit) as exc_info:
        ghr.main()
assert exc_info.code == 0

Running the test for the first time will create a folder cassettes in path/to/folder/github-release/tests which will contain a file.yml for each tests decorate by @pytest.mark.vcr().

For more information about this feature see the pytest-vcr docs

I think you could try to use that and see if it's compatible your testing. I could create a PR and try if you want!

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

No branches or pull requests

2 participants