@@ -51,7 +51,7 @@ def shell(cmds, **kwds):
51
51
def info (message , * args ):
52
52
if args :
53
53
message = message % args
54
- _echo (click .style (message , bold = True , fg = 'green' ))
54
+ click . echo (click .style (message , bold = True , fg = 'green' ))
55
55
56
56
57
57
def can_write_to_path (path , ** kwds ):
@@ -64,20 +64,13 @@ def can_write_to_path(path, **kwds):
64
64
def error (message , * args ):
65
65
if args :
66
66
message = message % args
67
- _echo (click .style (message , bold = True , fg = 'red' ), err = True )
67
+ click . echo (click .style (message , bold = True , fg = 'red' ), err = True )
68
68
69
69
70
70
def warn (message , * args ):
71
71
if args :
72
72
message = message % args
73
- _echo (click .style (message , fg = 'red' ), err = True )
74
-
75
-
76
- def _echo (message , err = False ):
77
- if sys .version_info [0 ] == 2 :
78
- click .echo (message , err = err )
79
- else :
80
- print (message )
73
+ click .echo (click .style (message , fg = 'red' ), err = True )
81
74
82
75
83
76
def shell_join (* args ):
@@ -133,7 +126,7 @@ def find_matching_directories(path, pattern, recursive):
133
126
134
127
@contextlib .contextmanager
135
128
def real_io ():
136
- """Ensure stdout and stderr have ``fileno`` attributes .
129
+ """Ensure stdout and stderr have supported ``fileno() `` method .
137
130
138
131
nosetests replaces these streams with :class:`StringIO` objects
139
132
that may not work the same in every situtation - :func:`subprocess.Popen`
@@ -142,9 +135,8 @@ def real_io():
142
135
original_stdout = sys .stdout
143
136
original_stderr = sys .stderr
144
137
try :
145
- if not hasattr (sys . stdout , "fileno" ):
138
+ if commands . redirecting_io (sys = sys ):
146
139
sys .stdout = sys .__stdout__
147
- if not hasattr (sys .stderr , "fileno" ):
148
140
sys .stderr = sys .__stderr__
149
141
yield
150
142
finally :
0 commit comments