Fixed praw caching cassette requests, pytest-xdist compatability.

This commit is contained in:
Michael Lazar
2016-08-10 23:19:13 -07:00
parent a09592c570
commit bd7c63cd5f
23 changed files with 28118 additions and 4798 deletions

View File

@@ -178,6 +178,10 @@ def reddit(vcr, request):
reddit = praw.Reddit(user_agent='rtv test suite',
decode_html_entities=False,
disable_update_check=True)
# praw uses a global cache for requests, so we need to clear it
# before each unit test. Otherwise we may fail to generate new
# cassettes.
reddit.handler.clear_cache()
if request.config.option.record_mode == 'none':
# Turn off praw rate limiting when using cassettes
reddit.config.api_request_delay = 0