Skip to content

Find Something Other Than StringIO to Capture Output #5

Description

@Stunner

There appears to be a bug within Python 2.7.x's version of StringIO. Resolving this would allow for the removal of this workaround code which is necessary for tests to pass.

Sun 07/14 01:50 AM in ~/Documents/findmissing/tests (master)
tsrawat $ python
Python 2.7.15 (default, Jun  9 2018, 17:57:13)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> co = io.StringIO()
>>> import sys
>>> sys.stdout = co
>>> sys.path.append('..')
>>> from findmissing import print_diff
>>> print_diff(12, 1, 8, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "../findmissing.py", line 119, in print_diff
    print_last_seen(last_seen)
  File "../findmissing.py", line 92, in print_last_seen
    print(last_seen)
TypeError: unicode argument expected, got 'str'
>>> quit()
Sun 07/14 01:55 AM in ~/Documents/findmissing/tests (master)
tsrawat $ python
Python 2.7.15 (default, Jun  9 2018, 17:57:13)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from findmissing import print_diff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named findmissing
>>> import sys
>>> sys.path.append('..')
>>> from findmissing import print_diff
>>> print_diff(12, 1, 8, 0)
9
10
11
12
13
14
15
16
17
18
19
20
False

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions