Skip to content

Commit

Permalink
Set sys.ps1='' in tests to silence hypothesis
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Zhou committed Jan 9, 2020
1 parent df78526 commit 76cdf4d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/conftest.py
@@ -1,3 +1,5 @@
import sys

import pytest

from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_OPERATION
Expand Down Expand Up @@ -27,3 +29,19 @@ def clear_caches():
_ALL_POST_FUZZ_HOOKS_BY_TAG.clear()
_RERUN_POST_FUZZ_HOOKS_BY_OPERATION.clear()
_RERUN_POST_FUZZ_HOOKS_BY_TAG.clear()


@pytest.fixture(autouse=True, scope='session')
def trick_hypothesis():
"""In theory we're not supposed to use hypothesis'
strategy.example(), but fuzz-lightyear isn't using
hypothesis in a normal way.
HACK: Thus, let's silence the warning that hypothesis
logs, making a lot easier to interpret fuzz-lightyear
test results.
Relevant hypothesis code:
https://github.com/HypothesisWorks/hypothesis/blob/83a98364d30b88085adf2a0d0a1f7ca1ba2d4ce5/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py#L273
"""
sys.ps1 = ''

0 comments on commit 76cdf4d

Please sign in to comment.