cleanup and extra fixes

This commit is contained in:
Gil Forsyth 2016-06-22 18:23:36 -04:00
parent 4eff251964
commit 6f4fc7564e
6 changed files with 15 additions and 11 deletions

View file

@ -19,7 +19,7 @@ from tools import mock_xonsh_env
def test_reglob_tests():
testfiles = reglob('test_.*')
for f in testfiles:
assert_true(f.startswith('test_'))
assert (f.startswith('test_'))
@pytest.mark.skipif(ON_WINDOWS, reason='Unix stuff')
def test_repath_backslash():

View file

@ -1,6 +1,6 @@
"""Tests xonsh contexts."""
from tools import (mock_xonsh_env, execer_setup, check_exec, check_eval,
check_parse, skip_if)
check_parse)
from xonsh.contexts import Block, Functor

View file

@ -56,7 +56,7 @@ def test_hist_flush():
pass
with LazyJSON(FNAME) as lj:
obs = lj['cmds'][0]['joco']
assert 'still alive' == ob
assert 'still alive' == obs
os.remove(FNAME)

View file

@ -17,6 +17,10 @@ def test_login_shell():
xonsh.main.premain([])
assert (builtins.__xonsh_env__.get('XONSH_LOGIN'))
with patch('xonsh.main.Shell', Shell), mock_xonsh_env({}):
xonsh.main.premain(['-i'])
assert (builtins.__xonsh_env__.get('XONSH_LOGIN'))
with patch('xonsh.main.Shell', Shell), mock_xonsh_env({}):
xonsh.main.premain(['-l', '-c', 'echo "hi"'])
assert (builtins.__xonsh_env__.get('XONSH_LOGIN'))

View file

@ -11,15 +11,16 @@ from xonsh.tools import swap
from xonsh.shell import Shell
from xonsh.replay import Replayer
from tools import ON_MAC, skip_if
from tools import ON_MAC
SHELL = Shell({'PATH': []})
HISTDIR = os.path.join(os.path.dirname(__file__), 'histories')
def run_replay(re_file):
with swap(builtins, '__xonsh_shell__', SHELL):
r = Replayer(re_file)
hist = r.replay()
with swap(builtins, '__xonsh_exit__', False):
r = Replayer(re_file)
hist = r.replay()
return hist
@ -37,21 +38,20 @@ def a_replay(re_file):
cleanup_replay(hist)
@skip_if(ON_MAC)
@pytest.mark.skipif(ON_MAC, reason='Not mac friendly')
def test_echo():
f = os.path.join(HISTDIR, 'echo.json')
with a_replay(f) as hist:
assert 2 == len(hist)
@skip_if(ON_MAC)
@pytest.mark.skipif(ON_MAC, reason='also not mac friendly')
def test_reecho():
f = os.path.join(HISTDIR, 'echo.json')
with a_replay(f) as hist:
assert 2 == len(hist)
@skip_if(ON_MAC)
@pytest.mark.skipif(ON_MAC, reason='also not mac friendly')
def test_simple_python():
f = os.path.join(HISTDIR, 'simple-python.json')
with a_replay(f) as hist:

View file

@ -874,6 +874,6 @@ def test_expand_case_matching():
def test_commands_cache_lazy():
cc = CommandsCache()
assertfalse == cc.lazyin('xonsh')
assert not cc.lazyin('xonsh')
assert 0 == len(list(cc.lazyiter()))
assert 0 == cc.lazylen()