Skip to content

Commit

Permalink
tests: Remove old hack we do not need any more
Browse files Browse the repository at this point in the history
Branch that fixed this has been merged Oct 2019.
  • Loading branch information
christian-intra2net committed Jun 20, 2022
1 parent f7f6100 commit baf311d
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tests/test_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def call_and_capture(module, args=None, accept_nonzero_exit=False,
Only drawback sofar: stdout and stderr are merged into one (which is
what users see on their shell as well). When testing for json-compatible
output you should `exclude_stderr` to `False` since logging ignores stderr,
so unforseen warnings (e.g. issued by pypy) would mess up your json.
so unforeseen warnings (e.g. issued by pypy) would mess up your json.
:param str module: name of module to test, e.g. `olevba`
:param args: arguments for module's main function
:param bool fail_nonzero: Raise error if command returns non-0 return code
:param bool accept_nonzero_exit: Do not raise error if command returns non-0 return code
:param bool exclude_stderr: Exclude output to `sys.stderr` from output
(e.g. if parsing output through json)
:returns: output, ret_codt
:rtype: int, str
:returns: output, ret_code
:rtype: str, int
"""
# create a PYTHONPATH environment var to prefer our current code
env = os.environ.copy()
Expand All @@ -47,13 +47,6 @@ def call_and_capture(module, args=None, accept_nonzero_exit=False,
except KeyError:
env['PYTHONPATH'] = SOURCE_BASE_DIR

# hack: in python2 output encoding (sys.stdout.encoding) was None
# although sys.getdefaultencoding() and sys.getfilesystemencoding were ok
# TODO: maybe can remove this once branch
# "encoding-for-non-unicode-environments" is merged
if 'PYTHONIOENCODING' not in env:
env['PYTHONIOENCODING'] = 'utf8'

# ensure args is a tuple
my_args = tuple(args) if args else ()

Expand Down

0 comments on commit baf311d

Please sign in to comment.