Skip to content

Commit

Permalink
Updated environment string for test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
smsearcy authored and c4urself committed Apr 19, 2018
1 parent b41298f commit 1570a00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions bumpversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def commit(cls, message):
f = NamedTemporaryFile('wb', delete=False)
f.write(message.encode('utf-8'))
f.close()
subprocess.check_output(cls._COMMIT_COMMAND + [f.name], env=dict(
list(os.environ.items()) + [(str('HGENCODING'), str('utf-8'))]
))
env = os.environ.copy()
env['HGENCODING'] = 'utf-8'
subprocess.check_output(cls._COMMIT_COMMAND + [f.name], env=env)
os.unlink(f.name)

@classmethod
Expand Down Expand Up @@ -824,7 +824,7 @@ def main(original_args=None):

if args.dry_run:
logger.info("Dry run active, won't touch any files.")

if args.new_version:
new_version = vc.parse(args.new_version)

Expand Down
9 changes: 6 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import unicode_literals, print_function

import os
import pytest
import sys
import logging
Expand All @@ -20,9 +21,11 @@
from bumpversion import main, DESCRIPTION, WorkingDirectoryIsDirtyException, \
split_args_in_optional_and_positional

SUBPROCESS_ENV = dict(
list(environ.items()) + [(b'HGENCODING', b'utf-8')]
)
def _get_subprocess_env():
env = os.environ.copy()
env['HGENCODING'] = 'utf-8'
return env
SUBPROCESS_ENV = _get_subprocess_env()

call = partial(subprocess.call, env=SUBPROCESS_ENV)
check_call = partial(subprocess.check_call, env=SUBPROCESS_ENV)
Expand Down

0 comments on commit 1570a00

Please sign in to comment.