Merge branch 'master' into amalcomp

This commit is contained in:
Anthony Scopatz 2016-07-17 18:41:05 -04:00
commit b32492f39b
8 changed files with 64 additions and 46 deletions

View file

@ -1,9 +1,6 @@
version: 0.4.3.{build}
os: Windows Server 2012 R2
install:
- C:\Python35\Scripts\pip install ply pyreadline pytest pygments prompt_toolkit
build_script:
- C:\Python35\python setup.py install
- C:\Python35\Scripts\pip install --upgrade -r requirements-tests.txt
test_script:
- C:\Python35\Scripts\py.test

7
.coveragerc Normal file
View file

@ -0,0 +1,7 @@
[run]
branch = true
omit =
tests/*
xonsh/__amalgam__.py
*/parser*_table.py
setup.py

View file

@ -4,8 +4,8 @@ python:
- 3.5
- "nightly"
install:
- pip install -r requirements-tests.txt
- pip install --upgrade -r requirements-tests.txt
script:
- coverage run --source xonsh -m py.test -q
- py.test --flake8 --cov=. --cov-report=term
after_success:
- codecov

2
conftest.py Normal file
View file

@ -0,0 +1,2 @@
# empty file to trick py.test into adding the root folder to sys.path
# see https://github.com/pytest-dev/pytest/issues/911 for more info

View file

@ -1,6 +1,7 @@
ply
pytest
pytest-flake8
pytest-cov
prompt-toolkit
pygments
coverage
codecov

15
setup.cfg Normal file
View file

@ -0,0 +1,15 @@
[pytest]
addopts = --flake8
flake8-max-line-length = 180
flake8-ignore =
# Temporary until we fix all the errors
*.py E301 E302 E303 W391 E402 E127 E128 E201 E731 E701 E271 E265 E266 E225 E202 E502 E231 E228 E227 E203 E122 E251 W291 E124 E261 E125 E111 E222 E272 F401 F811 F841 F821 F402
__amalgam__.py ALL
# test files should be PEP8 but a ton of errors for now
test_*.py ALL
# we don't care about sphinx autogenerated files
docs/*.py ALL
# we don't care about ply files?
ply/*.py ALL
# these run VERY slowly and give tons of errors
parser*_table.py ALL

View file

@ -978,46 +978,42 @@ def test_argvquote(st, esc):
assert esc == obs
_leaders = ('', 'not empty')
_r = ('r', '')
_b = ('b', '')
_u = ('u', '')
_chars = set(i+j+k for i in _r for j in _b for k in _u)
_chars |= set(i+j+k for i in _r for j in _u for k in _b)
_chars |= set(i+j+k for i in _b for j in _u for k in _r)
_chars |= set(i+j+k for i in _b for j in _r for k in _u)
_chars |= set(i+j+k for i in _u for j in _r for k in _b)
_chars |= set(i+j+k for i in _u for j in _b for k in _r)
_squote = ('"""', '"', "'''", "'")
_startend = {c+s: s for c in _chars for s in _squote}
inners = "this is a string"
@pytest.mark.parametrize('inp', ['no string here', ''])
def test_partial_string_none(inp):
assert check_for_partial_string(inp) == (None, None, None)
def test_partial_string():
# single string at start
assert check_for_partial_string('no strings here') == (None, None, None)
assert check_for_partial_string('') == (None, None, None)
for s, e in _startend.items():
_test = s + inners + e
for l in _leaders:
for f in _leaders:
@pytest.mark.parametrize('leaders', [
(('', 0), ('not empty', 9)),
(('not empty', 9), ('', 0))
])
@pytest.mark.parametrize('prefix', ['b', 'rb', 'r' ])
@pytest.mark.parametrize('quote', ['"', '"""'])
def test_partial_string(leaders, prefix, quote):
(l, l_len), (f, f_len) = leaders
s = prefix + quote
t = s + 'test string' + quote
t_len = len(t)
# single string
_res = check_for_partial_string(l + _test + f)
assert _res == (len(l), len(l) + len(_test), s)
test_string = l + t + f
obs = check_for_partial_string(test_string)
exp = l_len, l_len + t_len, s
assert obs == exp
# single partial
_res = check_for_partial_string(l + f + s + inners)
assert _res == (len(l+f), None, s)
for s2, e2 in _startend.items():
_test2 = s2 + inners + e2
for l2 in _leaders:
for f2 in _leaders:
test_string = l + f + s + 'test string'
obs = check_for_partial_string(test_string)
exp = l_len + f_len, None, s
assert obs == exp
# two strings
_res = check_for_partial_string(l + _test + f + l2 + _test2 + f2)
assert _res == (len(l+_test+f+l2), len(l+_test+f+l2+_test2), s2)
test_string = l + t + f + l + t + f
obs = check_for_partial_string(test_string)
exp = (l_len + t_len + f_len + l_len), (l_len + t_len + f_len + l_len + t_len), s
assert obs == exp
# one string, one partial
_res = check_for_partial_string(l + _test + f + l2 + s2 + inners)
assert _res == (len(l+_test+f+l2), None, s2)
test_string = l + t + f + l + s + 'test string'
obs = check_for_partial_string(test_string)
exp = l_len + t_len + f_len + l_len , None, s
assert obs == exp
def test_executables_in(xonsh_builtins):

View file

@ -984,7 +984,7 @@ def current_branch(pad=NotImplemented):
if isinstance(branch, subprocess.TimeoutExpired):
branch = '<branch-timeout>'
_first_branch_timeout_message()
return branch
return branch or None
def git_dirty_working_directory(cwd=None, include_untracked=False):