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_can_turn_off_subarrays is flaky #1798

Closed
DRMacIver opened this issue Feb 5, 2019 · 4 comments · Fixed by #1963
Closed

test_can_turn_off_subarrays is flaky #1798

DRMacIver opened this issue Feb 5, 2019 · 4 comments · Fixed by #1963
Labels
flaky-tests for when our tests only sometimes pass

Comments

@DRMacIver
Copy link
Member

Every now and then I see the following error from it:

570, in do_draw
    result = self.pack(data.draw(self.mapped_strategy))
ValueError: field 'f1' occurs more than once

For example here: https://travis-ci.org/HypothesisWorks/hypothesis/jobs/489245732#L1288

In this example it's on Python 2 but I don't know whether that's essential.

@DRMacIver DRMacIver added the flaky-tests for when our tests only sometimes pass label Feb 5, 2019
@Zac-HD
Copy link
Member

Zac-HD commented Apr 7, 2019

I've never seen this in the two months since #1803. Yay heisenbugs I guess?

@Zac-HD
Copy link
Member

Zac-HD commented Apr 19, 2019

Closing this as I can't reproduce it and haven't seen it since #1803.

@Zac-HD
Copy link
Member

Zac-HD commented May 7, 2019

We finally saw this happen on Windows 64bit, Python 2.7!

_________________________ test_np_dtype_is_idempotent _________________________
Traceback (most recent call last):
  ...
ValueError: field 'f3' occurs more than once
---------------------------- Captured stdout call -----------------------------
Got invalid dtype value=[('\xfe\xfe\x84X', dtype('>m8[ns]')), ('\xd0\xb1%`$\x08\t@\xb4C4\xdf\xecJ\xfe\xfc\x9e0', dtype('>c8')), ('f3', dtype('<M8[M]')), ('', dtype('float64')), ('W\xaaB\xfb\xa7\x1b', dtype('>u2'), (2, 1))] from strategy=lists(elements=one_of(tuples(binary(), <hypothesis.searchstrategy.recursive.LimitedStrategy at 0x1324c128>), tuples(binary(), <hypothesis.searchstrategy.recursive.LimitedStrategy at 0x1324c128>, array_shapes(max_dims=2, max_side=2))), min_size=1, max_size=5, unique_by=lambda d: d[0]), function=<function array_dtypes at 0x0000000008B7A128>
--------------------------------- Hypothesis ----------------------------------
You can add @seed(315459762023301249284010228506111077501) to this test or run pytest with --hypothesis-seed=315459762023301249284010228506111077501 to reproduce this failure.
  File "D:\a\1\s\hypothesis-python\tests\numpy\test_gen_data.py", line 214, in test_np_dtype_is_idempotent
    def test_np_dtype_is_idempotent(dtype):
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 987, in wrapped_test
    state.run()
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 660, in run
    runner.run()
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\engine.py", line 398, in run
    self._run()
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\engine.py", line 769, in _run
    self.generate_new_examples()
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\engine.py", line 753, in generate_new_examples
    self.test_function(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\engine.py", line 144, in test_function
    self.__stoppable_test_function(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\engine.py", line 127, in __stoppable_test_function
    self._test_function(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 626, in evaluate_test_data
    escalate_hypothesis_internal_error()
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 606, in evaluate_test_data
    result = self.execute(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 571, in execute
    result = self.test_runner(data, run)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\executors.py", line 56, in default_new_style_executor
    return function(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\core.py", line 550, in run
    args, kwargs = data.draw(self.search_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 849, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in do_draw
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in <genexpr>
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 560, in do_draw
    result = self.pack(data.draw(self.mapped_strategy))
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 560, in do_draw
    result = self.pack(data.draw(self.mapped_strategy))
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in do_draw
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in <genexpr>
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 636, in do_draw
    data=data, filter_strategy=self
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 356, in do_filtered_draw
    return filter_strategy.default_do_filtered_draw(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 651, in default_do_filtered_draw
    value = data.draw(self.filtered_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\recursive.py", line 100, in do_draw
    return data.draw(self.strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 498, in do_draw
    return data.draw(self.element_strategies[i], label=self.branch_labels[i])
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 560, in do_draw
    result = self.pack(data.draw(self.mapped_strategy))
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 160, in do_draw
    data=data, filter_strategy=filtered
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 356, in do_filtered_draw
    return filter_strategy.default_do_filtered_draw(data)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 651, in default_do_filtered_draw
    value = data.draw(self.filtered_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 498, in do_draw
    return data.draw(self.element_strategies[i], label=self.branch_labels[i])
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in do_draw
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\collections.py", line 59, in <genexpr>
    return tuple(data.draw(e) for e in self.element_strategies)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 498, in do_draw
    return data.draw(self.element_strategies[i], label=self.branch_labels[i])
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\lazy.py", line 156, in do_draw
    return data.draw(self.wrapped_strategy)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 834, in draw
    return self.__draw(strategy, label=label)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\internal\conjecture\data.py", line 843, in __draw
    return strategy.do_draw(self)
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\searchstrategy\strategies.py", line 560, in do_draw
    result = self.pack(data.draw(self.mapped_strategy))
  File "c:\hostedtoolcache\windows\python\2.7.14\x64\lib\site-packages\hypothesis\extra\numpy.py", line 457, in convert_to_dtype
    return np.dtype(x)

I'll update with more details as they come.

@Zac-HD Zac-HD reopened this May 7, 2019
@Zac-HD
Copy link
Member

Zac-HD commented May 7, 2019

OK, it looks like this is triggered by a weird behaviour of np.dtype that can be rarely found by npst.array_dtypes(). Here goes:

np.dtype([("f1", int), ("", int)]) fails, as does anything where the name "f{index}" exists elsewhere but the name at the index is "" (e.g. dtype([('', int), ('f0', int)])) - the empty name defaults to the f{index} name even if it exists elsewhere, but obviously the unique_by doesn't catch that. I'll discuss this with upstream, but regardless we can simply ensure that all field names are non-empty to work around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-tests for when our tests only sometimes pass
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants