Page MenuHomeSoftware Heritage
Paste P334

hypothesis storage mimetype
ActivePublic

Authored by vlorentz on Nov 15 2018, 10:52 AM.
pytest swh/indexer/tests/storage/test_storage.py -x
========================================================================================================= test session starts =========================================================================================================
platform linux -- Python 3.5.3, pytest-3.9.3, py-1.7.0, pluggy-0.8.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/dev/swh-environment/swh-indexer/.hypothesis/examples')
rootdir: /home/dev/swh-environment/swh-indexer, inifile: pytest.ini
plugins: requests-mock-1.5.2, hypothesis-3.74.0, celery-4.2.1
collected 38 items
swh/indexer/tests/storage/test_storage.py F
============================================================================================================== FAILURES ===============================================================================================================
_________________________________________________________________________________ PropBasedTestStorage.test_generate_content_mimetype_get_range_limit _________________________________________________________________________________
self = <swh.indexer.tests.storage.test_storage.PropBasedTestStorage testMethod=test_generate_content_mimetype_get_range_limit>
@given(gen_content_mimetypes(min_size=4, max_size=4))
> def test_generate_content_mimetype_get_range_limit(self, mimetypes):
E hypothesis.errors.MultipleFailures: Hypothesis found 2 distinct failures.
swh/indexer/tests/storage/test_storage.py:1658: MultipleFailures
------------------------------------------------------------------------------------------------------------- Hypothesis --------------------------------------------------------------------------------------------------------------
Falsifying example: test_generate_content_mimetype_get_range_limit(self=<swh.indexer.tests.storage.test_storage.PropBasedTestStorage testMethod=test_generate_content_mimetype_get_range_limit>, mimetypes=[{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'indexer_configuration_id': 1,
'mimetype': b'application/json'},
{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01',
'indexer_configuration_id': 1,
'mimetype': b'application/json'},
{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02',
'indexer_configuration_id': 1,
'mimetype': b'application/json'},
{'encoding': b'iso8859-15',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'indexer_configuration_id': 1,
'mimetype': b'application/json'}])
Traceback (most recent call last):
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 660, in run
falsifying_example.__expected_traceback,
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 519, in execute
result = self.test_runner(data, run)
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/executors.py", line 58, in default_new_style_executor
return function(data)
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 517, in run
return test(*args, **kwargs)
File "/home/dev/swh-environment/swh-indexer/swh/indexer/tests/storage/test_storage.py", line 1658, in test_generate_content_mimetype_get_range_limit
def test_generate_content_mimetype_get_range_limit(self, mimetypes):
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 464, in test
result = self.test(*args, **kwargs)
File "/home/dev/swh-environment/swh-indexer/swh/indexer/tests/storage/test_storage.py", line 1681, in test_generate_content_mimetype_get_range_limit
self.assertIsNotNone(actual_next)
File "/usr/lib/python3.5/unittest/case.py", line 1230, in assertIsNotNone
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.5/unittest/case.py", line 666, in fail
raise self.failureException(msg)
AssertionError: unexpectedly None
You can reproduce this example by temporarily adding @reproduce_failure('3.74.0', b'AXicY2AgGjASKcbAwMTAAAAApAAF') as a decorator on your test case
Falsifying example: test_generate_content_mimetype_get_range_limit(self=<swh.indexer.tests.storage.test_storage.PropBasedTestStorage testMethod=test_generate_content_mimetype_get_range_limit>, mimetypes=[{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'indexer_configuration_id': 1,
'mimetype': b'application/json'},
{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01',
'indexer_configuration_id': 1,
'mimetype': b'application/json'},
{'encoding': b'iso8859-1',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'indexer_configuration_id': 1,
'mimetype': b'application/octet-stream'},
{'encoding': b'iso8859-15',
'id': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
'indexer_configuration_id': 1,
'mimetype': b'application/json'}])
Traceback (most recent call last):
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 660, in run
falsifying_example.__expected_traceback,
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 519, in execute
result = self.test_runner(data, run)
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/executors.py", line 58, in default_new_style_executor
return function(data)
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 517, in run
return test(*args, **kwargs)
File "/home/dev/swh-environment/swh-indexer/swh/indexer/tests/storage/test_storage.py", line 1658, in test_generate_content_mimetype_get_range_limit
def test_generate_content_mimetype_get_range_limit(self, mimetypes):
File "/home/dev/.local/lib/python3.5/site-packages/hypothesis/core.py", line 464, in test
result = self.test(*args, **kwargs)
File "/home/dev/swh-environment/swh-indexer/swh/indexer/tests/storage/test_storage.py", line 1680, in test_generate_content_mimetype_get_range_limit
self.assertEqual(limited_results, len(actual_ids))
File "/usr/lib/python3.5/unittest/case.py", line 821, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.5/unittest/case.py", line 814, in _baseAssertEqual
raise self.failureException(msg)
AssertionError: 3 != 2
You can reproduce this example by temporarily adding @reproduce_failure('3.74.0', b'AXicY2AgGjCSIggAAKAABA==') as a decorator on your test case