Fixing Python 3 test incompatibility with builtins.
This commit is contained in:
parent
aa48b95ee7
commit
ee5697ac37
2 changed files with 8 additions and 3 deletions
|
@ -28,7 +28,7 @@ def create_archive(excludes_filename, verbose, source_directories, repository):
|
|||
|
||||
try:
|
||||
subprocess.check_output(command, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError, error:
|
||||
except subprocess.CalledProcessError as error:
|
||||
print(error.output.strip(), file=sys.stderr)
|
||||
|
||||
if re.search('Error: Repository .* does not exist', error.output):
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
from collections import OrderedDict
|
||||
import sys
|
||||
try:
|
||||
# Python 2
|
||||
import __builtin__ as builtins
|
||||
except ImportError:
|
||||
# Python 3
|
||||
import builtins
|
||||
|
||||
from flexmock import flexmock
|
||||
from nose.tools import assert_raises
|
||||
|
@ -23,7 +28,7 @@ def insert_subprocess_check_output_mock(call_command, error_output=None, **kwarg
|
|||
|
||||
if error_output:
|
||||
expectation.and_raise(MockCalledProcessError, output=error_output)
|
||||
flexmock(sys.modules['__builtin__']).should_receive('print')
|
||||
flexmock(builtins).should_receive('print')
|
||||
|
||||
flexmock(module).subprocess = subprocess
|
||||
return subprocess
|
||||
|
|
Loading…
Reference in a new issue