@pytest.mark.installed
def test_activate_does_not_leak_echo_setting(shell):
 if ((not on_win) or (shell != u'cmd.exe')):
  pytest.skip(u"echo leaking is only relevant on Window's CMD.EXE")
 shell_vars = _format_vars(shell)
 with TemporaryDirectory(prefix=u'envs', dir=os.path.dirname(__file__)) as envs:
  (env_dirs, env_vars) = gen_test_env_paths(envs, shell)
  scripts = []
  src_activate = shell_vars[u'source'].format(u'{syspath}{binpath}activate{suffix_executable}')
  scripts += [dedent(u'            @ECHO ON\n            {} "{{env_dirs[0]}}"\n            @ECHO\n            ')]
  for script in scripts:
   script = script.format(src_activate)
   script = script.format(env_vars=env_vars, env_dirs=env_dirs, **shell_vars)
   commands = (shell_vars[u'command_setup'] + script)
   (stdout, stderr) = run_in(commands, shell)
   print(u'commands:', commands)
   print(u'stdout:', stdout)
   print(u'stderr:', stderr)
   assert_equals(stdout, u'ECHO is on.', stderr)
   assert_equals(stderr, u'')

@ pytest . mark . installed def test_activate_does_not_leak_echo_setting ( shell ) : if ( ( not on_win ) or ( shell != u'cmd.exe' ) ) : pytest . skip ( u"echo leaking is only relevant on Window's CMD.EXE" ) shell_vars = _format_vars ( shell ) with TemporaryDirectory ( prefix = u'envs' , dir = os . path . dirname ( __file__ ) ) as envs : ( env_dirs , env_vars ) = gen_test_env_paths ( envs , shell ) scripts = [ ] src_activate = shell_vars [ u'source' ] . format ( u'{syspath}{binpath}activate{suffix_executable}' ) scripts += [ dedent ( u'            @ECHO ON\n            {} "{{env_dirs[0]}}"\n            @ECHO\n            ' ) ] for script in scripts : script = script . format ( src_activate ) script = script . format ( env_vars = env_vars , env_dirs = env_dirs , ** shell_vars ) commands = ( shell_vars [ u'command_setup' ] + script ) ( stdout , stderr ) = run_in ( commands , shell ) print ( u'commands:' , commands ) print ( u'stdout:' , stdout ) print ( u'stderr:' , stderr ) assert_equals ( stdout , u'ECHO is on.' , stderr ) assert_equals ( stderr , u'' )
test that activates setting of echo to off does not disrupt later echo calls .