flask-expects-json
flask-expects-json copied to clipboard
Test failures
On Python 3.10 and Python 3.11 I'm unable to get the tests to pass in a clean environment.
$ python setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
[...]
test_validation_invalid (test_schema.TestExpects.test_validation_invalid) ... FAIL
test_validation_valid (test_schema.TestExpects.test_validation_valid) ... ok
======================================================================
FAIL: test_default_gets_validated (test_defaults.TestDefaults.test_default_gets_validated)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_defaults.py", line 81, in test_default_gets_validated
self.assertIn('5 is not of type 'string'', response.data.decode())
AssertionError: '5 is not of type 'string'' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>5 is not of type 'string'<br><br>Failed validating 'type' in schema['properties']['name']:<br> {'default': 5, 'type': 'string'}<br><br>On instance['name']:<br> 5</p>\n'
======================================================================
FAIL: test_format_validation_rejection (test_format_validation.TestDefaults.test_format_validation_rejection)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_format_validation.py", line 49, in test_format_validation_rejection
self.assertIn(''-12' is not a 'ipv4'', response.data.decode())
AssertionError: ''-12' is not a 'ipv4'' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>'-12' is not a 'ipv4'<br><br>Failed validating 'format' in schema['properties']['ipAddr']:<br> {'format': 'ipv4'}<br><br>On instance['ipAddr']:<br> '-12'</p>\n'
======================================================================
FAIL: test_default_behaviour (test_ignore.TestExpects.test_default_behaviour)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_ignore.py", line 33, in test_default_behaviour
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_ignore_multiple (test_ignore.TestExpects.test_ignore_multiple)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_ignore.py", line 57, in test_ignore_multiple
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_ignore_one (test_ignore.TestExpects.test_ignore_one)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_ignore.py", line 46, in test_ignore_one
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_check_mimetype (test_requests.TestExpects.test_check_mimetype)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_requests.py", line 55, in test_check_mimetype
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_valid_decorator (test_requests.TestExpects.test_valid_decorator)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_requests.py", line 40, in test_valid_decorator
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_valid_decorator_no_schema_async (test_requests.TestExpects.test_valid_decorator_no_schema_async)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_requests.py", line 47, in test_valid_decorator_no_schema_async
self.assertIn('Failed to decode', response.data.decode())
AssertionError: 'Failed to decode' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n'
======================================================================
FAIL: test_validation_invalid (test_schema.TestExpects.test_validation_invalid)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fab/Documents/repos/flask-expects-json/tests/test_schema.py", line 48, in test_validation_invalid
self.assertIn('is not of type 'number'', response.data.decode())
AssertionError: 'is not of type 'number'' not found in '<!doctype html>\n<html lang=en>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>'invalid' is not of type 'number'<br><br>Failed validating 'type' in schema['properties']['price']:<br> {'type': 'number'}<br><br>On instance['price']:<br> 'invalid'</p>\n'
----------------------------------------------------------------------
Ran 19 tests in 0.094s
FAILED (failures=9)
Test failed: <unittest.runner.TextTestResult run=19 errors=0 failures=9>
error: Test failed: <unittest.runner.TextTestResult run=19 errors=0 failures=9>