Repository: HypothesisWorks/hypothesis

Issue:
Verbose mode doesn't print explicit examples
To reproduce: Add a test with an example decorator, try running it in verbose mode, note that it doesn't print "Trying example:" for the ones provided by the decorators.



Discussion:

Resolving patch:
diff --git a/scripts/hypothesistooling.py b/scripts/hypothesistooling.py
--- a/scripts/hypothesistooling.py
+++ b/scripts/hypothesistooling.py
@@ -184,4 +184,4 @@ def modified_files():
 
 def all_files():
     return subprocess.check_output(['git', 'ls-files']).decode(
-        'ascii').split('\n')
+        'ascii').splitlines()
diff --git a/src/hypothesis/core.py b/src/hypothesis/core.py
--- a/src/hypothesis/core.py
+++ b/src/hypothesis/core.py
@@ -226,18 +226,20 @@ def execute_explicit_examples(
         # Note: Test may mutate arguments and we can't rerun explicit
         # examples, so we have to calculate the failure message at this
         # point rather than than later.
-        message_on_failure = 'Falsifying example: %s(%s)' % (
+        example_string = '%s(%s)' % (
             test.__name__, arg_string(test, arguments, example_kwargs)
         )
         try:
             with BuildContext(None) as b:
+                if settings.verbosity >= Verbosity.verbose:
+                    report('Trying example: ' + example_string)
                 test_runner(
                     None,
                     lambda data: test(*arguments, **example_kwargs)
                 )
         except BaseException:
             traceback.print_exc()
-            report(message_on_failure)
+            report('Falsifying example: ' + example_string)
             for n in b.notes:
                 report(n)
             raise
diff --git a/src/hypothesis/version.py b/src/hypothesis/version.py
--- a/src/hypothesis/version.py
+++ b/src/hypothesis/version.py
@@ -17,5 +17,5 @@
 
 from __future__ import division, print_function, absolute_import
 
-__version_info__ = (3, 11, 3)
+__version_info__ = (3, 11, 4)
 __version__ = '.'.join(map(str, __version_info__))


Test patch:
diff --git a/tests/cover/test_explicit_examples.py b/tests/cover/test_explicit_examples.py
--- a/tests/cover/test_explicit_examples.py
+++ b/tests/cover/test_explicit_examples.py
@@ -21,7 +21,7 @@
 
 import pytest
 
-from hypothesis import note, given, example, settings, reporting
+from hypothesis import Verbosity, note, given, example, settings, reporting
 from hypothesis.errors import InvalidArgument
 from tests.common.utils import capture_out
 from hypothesis.strategies import text, integers
@@ -162,6 +162,20 @@ def test_positive(x):
     assert u'Falsifying example: test_positive(x=-1)' in out
 
 
+def test_prints_verbose_output_for_explicit_examples():
+    @settings(verbosity=Verbosity.verbose)
+    @example('NOT AN INTEGER')
+    @given(integers())
+    def test_always_passes(x):
+        pass
+
+    with reporting.with_reporter(reporting.default):
+        with capture_out() as out:
+            test_always_passes()
+    out = out.getvalue()
+    assert u"Trying example: test_always_passes(x='NOT AN INTEGER')" in out
+
+
 def test_captures_original_repr_of_example():
     @example(x=[])
     @given(integers())