Spaces Data
Minimal test - lines (375, 469)
path: .spaces[5].metrics.mi.mi_sei
old: 17.038296395890494
new: 19.019210673039073
path: .spaces[5].metrics.mi.mi_original
old: 46.09340674227107
new: 45.396525103915266
path: .spaces[5].metrics.mi.mi_visual_studio
old: 26.955208621211153
new: 26.547675499365653
path: .spaces[5].metrics.loc.cloc
old: 8.0
new: 11.0
path: .spaces[5].metrics.loc.blank
old: 10.0
new: 11.0
path: .spaces[5].metrics.loc.sloc
old: 91.0
new: 95.0
Code
class TestExecution:
pytestmark = skiponwin32
def test_sysfind_no_permisson_ignored(self, monkeypatch, tmpdir):
noperm = tmpdir.ensure('noperm', dir=True)
monkeypatch.setenv("PATH", noperm, prepend=":")
noperm.chmod(0)
assert py.path.local.sysfind('jaksdkasldqwe') is None
def test_sysfind_absolute(self):
x = py.path.local.sysfind('test')
assert x.check(file=1)
y = py.path.local.sysfind(str(x))
assert y.check(file=1)
assert y == x
def test_sysfind_multiple(self, tmpdir, monkeypatch):
monkeypatch.setenv('PATH', "%s:%s" % (
tmpdir.ensure('a'),
tmpdir.join('b')),
prepend=":")
tmpdir.ensure('b', 'a')
x = py.path.local.sysfind(
'a', checker=lambda x: x.dirpath().basename == 'b')
assert x.basename == 'a'
assert x.dirpath().basename == 'b'
assert py.path.local.sysfind('a', checker=lambda x: None) is None
def test_sysexec(self):
x = py.path.local.sysfind('ls')
out = x.sysexec('-a')
for x in py.path.local().listdir():
assert out.find(x.basename) != -1
def test_sysexec_failing(self):
x = py.path.local.sysfind('false')
with pytest.raises(py.process.cmdexec.Error):
x.sysexec('aksjdkasjd')
def test_make_numbered_dir(self, tmpdir):
tmpdir.ensure('base.not_an_int', dir=1)
for i in range(10):
numdir = local.make_numbered_dir(prefix='base.', rootdir=tmpdir,
keep=2, lock_timeout=0)
assert numdir.check()
assert numdir.basename == 'base.%d' % i
if i >= 1:
assert numdir.new(ext=str(i-1)).check()
if i >= 2:
assert numdir.new(ext=str(i-2)).check()
if i >= 3:
assert not numdir.new(ext=str(i-3)).check()
def test_make_numbered_dir_case(self, tmpdir):
"""make_numbered_dir does not make assumptions on the underlying
filesystem based on the platform and will assume it _could_ be case
insensitive.
See issues:
- https://github.com/pytest-dev/pytest/issues/708
- https://github.com/pytest-dev/pytest/issues/3451
"""
d1 = local.make_numbered_dir(
prefix='CAse.', rootdir=tmpdir, keep=2, lock_timeout=0,
)
d2 = local.make_numbered_dir(
prefix='caSE.', rootdir=tmpdir, keep=2, lock_timeout=0,
)
assert str(d1).lower() != str(d2).lower()
assert str(d2).endswith('.1')
def test_make_numbered_dir_NotImplemented_Error(self, tmpdir, monkeypatch):
def notimpl(x, y):
raise NotImplementedError(42)
monkeypatch.setattr(os, 'symlink', notimpl)
x = tmpdir.make_numbered_dir(rootdir=tmpdir, lock_timeout=0)
assert x.relto(tmpdir)
assert x.check()
def test_locked_make_numbered_dir(self, tmpdir):
for i in range(10):
numdir = local.make_numbered_dir(prefix='base2.', rootdir=tmpdir,
keep=2)
assert numdir.check()
assert numdir.basename == 'base2.%d' % i
for j in range(i):
assert numdir.new(ext=str(j)).check()
def test_error_preservation(self, path1):
py.test.raises(EnvironmentError, path1.join('qwoeqiwe').mtime)
py.test.raises(EnvironmentError, path1.join('qwoeqiwe').read)
# def test_parentdirmatch(self):
# local.parentdirmatch('std', startmodule=__name__)
#