Yelp / Testify

A more pythonic testing framework.
Other
306 stars 67 forks source link

test_fake_result_format mad about unicode #207

Closed mrtyler closed 8 years ago

mrtyler commented 10 years ago

python 2.7 on snow leopard.

is this a subtle way of telling me my python environment is misconfigured wrt unicode?

[tyler@toaster:~/Testify]$ python -mipdb
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named ipdb

[tyler@toaster:~/Testify]$ PYTHONPATH=~/Testify ~/Testify/bin/testify -v test.test_runner_server_test TestRunnerServerTestCase.test_fake_result_format
test.test_runner_server_test TestRunnerServerTestCase.test_fake_result_format ... ok in 1.00s

PASSED.  1 test / 1 case: 1 passed, 0 failed.  (Total test time 1.00s)

[tyler@toaster:~/Testify]$ pip-2.7 install -t ~/Library/Python/2.7/lib/python/site-packages/ ipdb
[...]
Successfully installed ipdb ipython
Cleaning up...

[tyler@toaster:~/Testify]$ PYTHONPATH=~/Testify ~/Testify/bin/testify -v test.test_runner_server_test TestRunnerServerTestCase.test_fake_result_format
test.test_runner_server_test TestRunnerServerTestCase.test_fake_result_format ... fail: test.test_runner_server_test TestRunnerServerTestCase.test_fake_result_format
Traceback (most recent call last):
  File "./test/test_runner_server_test.py", line 378, in test_fake_result_format
    assert_equal(fake_result, real_result)
AssertionError: assertion failed: l == r
l: {'normalized_run_time': 'str', 'previous_run': 'NoneType', 'complete': 'bool', 'success': 'bool', 'exception_info': 'str', 'start_time': 'float', 'interrupted': 'NoneType', 'runner_id': 'str', 'failure': 'NoneType', 'exception_info_pretty': 'str', 'run_time': 'float', 'error': 'bool', 'exception_only': 'str', 'method': {'module': 'str', 'fixture_type': 'NoneType', 'class': 'str', 'full_name': 'str', 'name': 'str'}, 'end_time': 'float'}
r: {'normalized_run_time': 'str', 'previous_run': 'NoneType', 'complete': 'bool', 'success': 'bool', 'exception_info': 'str', 'start_time': 'float', 'interrupted': 'NoneType', 'runner_id': 'str', 'failure': 'NoneType', 'exception_info_pretty': 'unicode', 'run_time': 'float', 'error': 'bool', 'exception_only': 'str', 'method': {'module': 'str', 'fixture_type': 'NoneType', 'class': 'str', 'full_name': 'str', 'name': 'str'}, 'end_time': 'float'}

Diff:
l: {'normalized_run_time': 'str', 'previous_run': 'NoneType', 'complete': 'bool', 'success': 'bool', 'exception_info': 'str', 'start_time': 'float', 'interrupted': 'NoneType', 'runner_id': 'str', 'failure': 'NoneType', 'exception_info_pretty': '<str>', 'run_time': 'float', 'error': 'bool', 'exception_only': 'str', 'method': {'module': 'str', 'fixture_type': 'NoneType', 'class': 'str', 'full_name': 'str', 'name': 'str'}, 'end_time': 'float'}
r: {'normalized_run_time': 'str', 'previous_run': 'NoneType', 'complete': 'bool', 'success': 'bool', 'exception_info': 'str', 'start_time': 'float', 'interrupted': 'NoneType', 'runner_id': 'str', 'failure': 'NoneType', 'exception_info_pretty': '<unicode>', 'run_time': 'float', 'error': 'bool', 'exception_only': 'str', 'method': {'module': 'str', 'fixture_type': 'NoneType', 'class': 'str', 'full_name': 'str', 'name': 'str'}, 'end_time': 'float'}

FAIL in 0.01s

FAILED.  1 test / 1 case: 0 passed, 1 failed.  (Total test time 0.01s)
bukzor commented 10 years ago

I wrote this test. It asserts that the fake thing has the same type-structure as the real thing.

The fake uses bytes (aka python2 str) in the exception_info_pretty slot, while the real thing uses unicode there.

It may be that you're using a different version of ipython, and the ipython function we're using has been updated to use unicode there, but that seems unlikely given that there are ansi codes in that string.

asottile commented 10 years ago

Repeatable:

$ python --version
Python 2.7.3
$ virtualenv venv && source venv/bin/activate && pip install catbox && pip install -e . && pip install ipdb && testify test
asottile commented 10 years ago

Also repeatable in python 2.6.7 with the same steps

asottile commented 8 years ago

Obsolete via #317