Zac-HD / hypofuzz

Adaptive fuzzing of Hypothesis tests
https://hypofuzz.com/docs
GNU Affero General Public License v3.0
82 stars 3 forks source link

Not working with hypothesis >= 6.72.2 #29

Closed eseglem closed 10 months ago

eseglem commented 11 months ago

The last version of hypothesis I can get to run with hypofuzz is 6.72.1. It appears to be related to refactoring of the core runner here: https://github.com/HypothesisWorks/hypothesis/pull/3621

From 6.72.2 to 6.86.2 I get the following:

Process Process-2:
Traceback (most recent call last):
  File ".../lib/python3.11/site-packages/hypofuzz/hy.py", line 258, in _run_test_on
    args, kwargs = data.draw(self.__strategy)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/hypothesis/internal/conjecture/data.py", line 937, in draw
    strategy.validate()
    ^^^^^^^^^^^^^^^^^
AttributeError: 'Stuff' object has no attribute 'validate'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File ".../lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File ".../lib/python3.11/site-packages/hypofuzz/interface.py", line 91, in _fuzz_several
    fuzz_several(*tests)
  File ".../lib/python3.11/site-packages/hypofuzz/hy.py", line 378, in fuzz_several
    t.run_one()
  File ".../lib/python3.11/site-packages/hypofuzz/hy.py", line 198, in run_one
    result = self._run_test_on(self.generate_prefix())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/hypofuzz/hy.py", line 275, in _run_test_on
    traceback.format_exception(etype=type(e), value=e, tb=tb)
TypeError: format_exception() got an unexpected keyword argument 'etype'
Found a failing input for every test!

And from 6.87.0 up to latest it breaks due to:

INTERNALERROR>   File ".../lib/python3.11/site-packages/hypofuzz/hy.py", line 89, in from_hypothesis_test
INTERNALERROR>     _, _, _, search_strategy = process_arguments_to_given(
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> ValueError: not enough values to unpack (expected 4, got 3)

Removing the extra _, on line 89 gets past that error, but results in the same error as above.

Unfortunately, I am not familiar enough with the workings of hypothesis / hypofuzz to figure out any solution. It doesn't seem simple to me, since the return types changed.

Zac-HD commented 11 months ago

Yep, this is my fault - Hypothesis' private internals changed and I didn't notice we needed corresponding changes here.

ovgeorge commented 11 months ago

Trying to downgrade, but still getting

INTERNALERROR> ImportError: cannot import name 'Stuff' from 'hypothesis.core' (/home/g/c/ng/venv/lib/python3.11/site-packages/hypothesis/core.py)

even with 6.62.0

Zac-HD commented 10 months ago

Fixed in 128da6d07a7297256f4277070675996c86bc7452 🙂