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

test_drawing_from_recursive_strategy_is_thread_safe failed on Python 3.13.0b1 #4002

Open
Zac-HD opened this issue May 22, 2024 · 0 comments
Open
Labels
bug something is clearly wrong here interop how to play nicely with other packages

Comments

@Zac-HD
Copy link
Member

Zac-HD commented May 22, 2024

This is probably a problem in Hypothesis, of unclear age. I'm not planning to work on this immediately, because Python 3.13 is still in beta and we explicitly don't warrant that Hypothesis is threadsafe. (why this test? we accept patches, and we're testing overachievers)

_____________ test_drawing_from_recursive_strategy_is_thread_safe ______________
  Traceback (most recent call last):
    ...
  pytest.PytestUnhandledThreadExceptionWarning: Exception in thread Thread-4 (test)
  
  Traceback (most recent call last):
    File "python3.13/threading.py", line 1039, in _bootstrap_inner
      self.run()
      ~~~~~~~~^^
    File "python3.13/threading.py", line 990, in run
      self._target(*self._args, **self._kwargs)
      ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "hypothesis-python/tests/nocover/test_recursive.py", line 140, in test
      database=None, deadline=None, suppress_health_check=[HealthCheck.too_slow]
             ^^^
    File "hypothesis/core.py", line 1638, in wrapped_test
      raise the_error_hypothesis_found
    File "hypothesis/core.py", line 1605, in wrapped_test
      state.run_engine()
      ~~~~~~~~~~~~~~~~^^
    File "hypothesis/core.py", line 1133, in run_engine
      runner.run()
      ~~~~~~~~~~^^
    File "hypothesis/internal/conjecture/engine.py", line 693, in run
      self._run()
      ~~~~~~~~~^^
    File "hypothesis/internal/conjecture/engine.py", line 1145, in _run
      self.generate_new_examples()
      ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    File "hypothesis/internal/conjecture/engine.py", line 987, in generate_new_examples
      self.generate_mutations_from(data)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
    File "hypothesis/internal/conjecture/engine.py", line 1059, in generate_mutations_from
      new_data = self.cached_test_function(
          data.buffer[: ex1.start]
      ...<8 lines>...
          extend=BUFFER_SIZE,
      )
    File "hypothesis/internal/conjecture/engine.py", line 1367, in cached_test_function
      self.tree.simulate_test_function(dummy_data)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
    File "hypothesis/internal/conjecture/datatree.py", line 880, in simulate_test_function
      v = draw(node.transition.ir_type, node.transition.kwargs)
    File "hypothesis/internal/conjecture/datatree.py", line 851, in draw
      value = draw_func(**kwargs, forced=forced)
    File "hypothesis/internal/conjecture/data.py", line 2093, in draw_integer
      value = self.provider.draw_integer(
          **kwargs, forced=forced, fake_forced=fake_forced
      )
    File "hypothesis/internal/conjecture/data.py", line 1435, in draw_integer
      return self._draw_unbounded_integer(forced=forced, fake_forced=fake_forced)
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "hypothesis/internal/conjecture/data.py", line 1682, in _draw_unbounded_integer
      INT_SIZES_SAMPLER.sample(self._cd, forced=forced_i, fake_forced=fake_forced)
      ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "hypothesis/internal/conjecture/utils.py", line 200, in sample
      use_alternate = data.draw_boolean(
          alternate_chance,
      ...<2 lines>...
          observe=self.observe,
      )
    File "hypothesis/internal/conjecture/data.py", line 2261, in draw_boolean
      kwargs: BooleanKWargs = self._pooled_kwargs("boolean", {"p": p})
                              ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
    File "hypothesis/internal/conjecture/data.py", line 2300, in _pooled_kwargs
      return POOLED_KWARGS_CACHE[key]
             ~~~~~~~~~~~~~~~~~~~^^^^^
    File "hypothesis/internal/cache.py", line 79, in __getitem__
      self.__balance(i)
      ~~~~~~~~~~~~~~^^^
    File "hypothesis/internal/cache.py", line 218, in __balance
      self.__swap(i, j)
      ~~~~~~~~~~~^^^^^^
    File "hypothesis/internal/cache.py", line 193, in __swap
      assert self.data[j].sort_key < self.data[i].sort_key
  AssertionError: assert (0, [2, 1482408]) < (0, [2, 1482362])
   +  where (0, [2, 1482408]) = Entry(key=('boolean', ('p', 0.6171875)), value={'p': 0.6171875}, score=[2, 1482408], pins=0).sort_key
   +  and   (0, [2, 1482362]) = Entry(key=('boolean', ('p', 0.0)), value={'p': 0.0}, score=[2, 1482362], pins=0).sort_key
@Zac-HD Zac-HD added bug something is clearly wrong here interop how to play nicely with other packages labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here interop how to play nicely with other packages
Projects
None yet
Development

No branches or pull requests

1 participant