本文整理汇总了Python中pytest.debug_func函数的典型用法代码示例。如果您正苦于以下问题:Python debug_func函数的具体用法?Python debug_func怎么用?Python debug_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_func函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_newpy_overwriting_yes
def test_newpy_overwriting_yes(tmpdir):
"""
Run 'pytool newpy xyzzy' when xyzzy, xyzzy.py already exist.
Verify that confirmation is requested. Answer 'yes' and verify
that the existing file IS overwritten.
"""
pytest.debug_func()
xyzzy = toyfile(tmpdir, "xyzzy", content="original xyzzy")
xyzzy_py = toyfile(tmpdir, "xyzzy.py", content="original xyzzy.py")
with U.Chdir(tmpdir.strpath):
cmd = pexpect.which('pytool')
S = pexpect.spawn('%s newpy %s' % (cmd, xyzzy.strpath))
which = S.expect([r'Are you sure\? >',
'Error:',
pexpect.EOF])
if which == 0:
S.sendline('yes')
S.expect(pexpect.EOF)
elif which == 1:
print S.before + S.after
pytest.fail('unexpected exception')
else:
pytest.fail('should have asked about overwriting xyzzy')
exp = os.path.abspath(xyzzy_py.strpath)
got = os.readlink(xyzzy.strpath)
assert got == exp
expected = expected_xyzzy_py()
got = U.contents(xyzzy_py.strpath)
assert got == expected
开发者ID:tbarron,项目名称:backscratcher,代码行数:31,代码来源:test_pytool.py
示例2: test_hd_help
def test_hd_help():
"""
Verify that 'hd --help' does the right thing
"""
pytest.debug_func()
result = pexpect.run("hd --help")
assert "Hexdump stdin or a file" in result
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_hd.py
示例3: test_docopt
def test_docopt(fx_usage):
"""
Check that pstrack.__doc__ contains what docopt requires
"""
pytest.debug_func()
for strval in fx_usage:
assert any([strval in line for line in pstrack.__doc__.split("\n")])
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_pstrack.py
示例4: test_bmega
def test_bmega(fx_mchk):
"""
Test 'mag' for mebibits (1024^2)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "98765432", "94.19 Mib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例5: test_bgiga
def test_bgiga(fx_mchk):
"""
Test 'mag' for gibibits (1024^3)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "12398765432", "11.55 Gib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例6: test_bbit
def test_bbit(fx_mchk):
"""
Test 'mag' for bits (1024^0)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "999", "999.00 b"
fx_mchk.result = mag.main([fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例7: test_bkilo
def test_bkilo(fx_mchk):
"""
Test 'mag' for kibibits (1024^1)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "98765", "96.45 Kib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例8: test_gtx_hooks_create_all_already
def test_gtx_hooks_create_all_already(tmpdir):
"""
Ask to create all links, some already exist
"""
pytest.debug_func()
hooklist = ['first', 'second', 'third']
bn_d = gtxtest_setup_hldirs(tmpdir.strpath,
hooks=hooklist,
mklinks=['second'])
assertLink(bn_d['second']['hook'], bn_d['second']['link'])
hookdir = bn_d['hookdir']
linkdir = bn_d['linkdir']
S = pexpect.spawn("gtx hooks -C -H %s -l %s" % (hookdir, linkdir))
while True:
which = S.expect(["does not appear to have a link",
"already has link",
pexpect.EOF,
pexpect.TIMEOUT])
if 0 == which:
S.expect(r"Shall I add one\? >")
S.sendline("y")
elif 1 == which:
pass
else:
break
assert(" <-- " in S.before)
for hook in hooklist:
assertLink(bn_d[hook]['hook'], bn_d[hook]['link'])
开发者ID:tbarron,项目名称:backscratcher,代码行数:33,代码来源:test_gtx.py
示例9: test_gtx_hooks_create_all_nothing
def test_gtx_hooks_create_all_nothing(tmpdir):
"""
Create all links, nothing in place
"""
pytest.debug_func()
hooklist = ['one', 'two', 'three']
hl_d = gtxtest_setup_hldirs(tmpdir.strpath, hooks=hooklist)
hookdir = hl_d['hookdir']
linkdir = hl_d['linkdir']
S = pexpect.spawn("gtx hooks -C -H %s -l %s" % (hookdir, linkdir))
while True:
which = S.expect(["does not appear to have a link",
"already has link",
pexpect.EOF,
pexpect.TIMEOUT])
if 0 == which:
S.expect(r"Shall I add one\? >")
S.sendline("y")
elif 1 == which:
pytest.fail("'already has link' was not expected")
else:
break
S.expect(pexpect.EOF)
for hook in hooklist:
hpath = os.path.join(hl_d['hookdir'], hook)
lpath = os.path.join(hl_d['linkdir'], hook)
assert(os.path.exists(hpath))
assert(os.path.exists(lpath))
开发者ID:tbarron,项目名称:backscratcher,代码行数:31,代码来源:test_gtx.py
示例10: test_mcal_title
def test_mcal_title():
"""
Verify that title puts out what we expect
"""
pytest.debug_func()
result = mcal.title(1999, 2)
assert result == ' 1999.02 '
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mcal.py
示例11: test_gtx_hooks_create_name_already
def test_gtx_hooks_create_name_already(tmpdir):
"""
Create by name, some already there
"""
pytest.debug_func()
hooklist = ['one', 'two', 'three']
hl_d = gtxtest_setup_hldirs(tmpdir.strpath,
hooks=hooklist,
mklinks=['two'])
hookdir = hl_d['hookdir']
linkdir = hl_d['linkdir']
assertLink(hl_d['two']['hook'], hl_d['two']['link'])
S = pexpect.spawn("gtx hooks -C -H %s -l %s three" % (hookdir, linkdir))
while True:
which = S.expect(["does not appear to have a link",
"already has link",
pexpect.EOF,
pexpect.TIMEOUT])
if 0 == which:
S.expect(r"Shall I add one\? >")
S.sendline("y")
elif 1 == which:
pass
else:
break
S.expect(pexpect.EOF)
assertNoLink(hl_d['one']['hook'], hl_d['one']['link'])
assertLink(hl_d['two']['hook'], hl_d['two']['link'])
assertLink(hl_d['three']['hook'], hl_d['three']['link'])
开发者ID:tbarron,项目名称:backscratcher,代码行数:34,代码来源:test_gtx.py
示例12: test_newtool_overwriting_yes
def test_newtool_overwriting_yes(tmpdir):
"""
Run 'pytool newtool testtool tt' while testtool.py exists. Verify that
we are prompted about overwriting. Answer 'yes' and verify that the
original file is overwritten.
"""
pytest.debug_func()
tname = toyfile(tmpdir, "testtool.py", content=["original testtool.py"])
tlink = toyfile(tmpdir, "testtool", content=["original testtool"])
with U.Chdir(tmpdir.strpath):
cmd = pexpect.which("pytool")
if cmd is None:
pytest.skip("pytool not found")
S = pexpect.spawn("{} newtool {} tt".format(cmd, tlink))
which = S.expect([r'Are you sure\? >',
'Error:',
pexpect.EOF])
if which == 0:
S.sendline('yes')
S.expect(pexpect.EOF)
elif which == 1:
print S.before + S.after
pytest.fail('unexpected exception')
else:
pytest.fail("should have asked about overwriting {}".format(tname))
exp = tname.strpath
actual = tlink.readlink()
assert actual == exp
expected = expected_testtool_py()
got = tname.read().split("\n")
assert got == expected
开发者ID:tbarron,项目名称:backscratcher,代码行数:33,代码来源:test_pytool.py
示例13: test_newtool_overwriting_no
def test_newtool_overwriting_no(tmpdir):
"""
Run 'pytool newtool testtool tt' while testtool.py does exist. Verify
that we are prompted about overwriting. Answer 'no' and verify that the
original file is not overwritten.
"""
pytest.debug_func()
tname = toyfile(tmpdir, "testtool.py", content=["original testtool.py"])
tlink = toyfile(tmpdir, "testtool", content=["original testtool"])
with U.Chdir(tmpdir.strpath):
cmd = pexpect.which("pytool")
if cmd is None:
pytest.skip("pytool not found")
S = pexpect.spawn("{} newtool {} tt".format(cmd, tlink))
which = S.expect([r'Are you sure\? >',
'Error:',
pexpect.EOF])
if which == 0:
S.sendline('no')
S.expect(pexpect.EOF)
elif which == 1:
print S.before + S.after
pytest.fail('unexpected exception')
else:
pytest.fail("should have asked about overwriting {}".format(tname))
for fname in [tlink, tname]:
exp = "original %s" % fname.basename
got = fname.read()
assert got == exp
开发者ID:tbarron,项目名称:backscratcher,代码行数:30,代码来源:test_pytool.py
示例14: test_newtool
def test_newtool(tmpdir):
"""
Run 'pytool newtool testtool' while testtool.py does not exist.
Verify that testtool.py is created and has the right contents.
"""
pytest.debug_func()
toolname = toyfile(tmpdir, "testtool.py")
toollink = toyfile(tmpdir, "testtool")
with U.Chdir(tmpdir.strpath):
cmd = pexpect.which("pytool")
if cmd is None:
pytest.skip("pytool not found")
S = pexpect.spawn("{} newtool {} tt".format(cmd, toollink.strpath))
which = S.expect([r'Are you sure\? >',
'Error:',
pexpect.EOF])
if which == 0:
S.sendline('no')
S.expect(pexpect.EOF)
pytest.fail('should not have asked about overwriting')
elif which == 1:
print S.before + S.after
pytest.fail('unexpected exception')
assert toolname.strpath == toollink.readlink()
expected = expected_testtool_py()
got = toolname.read().split("\n")
assert got == expected
开发者ID:tbarron,项目名称:backscratcher,代码行数:29,代码来源:test_pytool.py
示例15: test_yotta
def test_yotta(fx_mchk):
"""
Test 'mag' for terabits (1000^8)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "75843541873239090087685432", "75.84 Yb"
fx_mchk.result = mag.main([fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例16: test_btera
def test_btera(fx_mchk):
"""
Test 'mag' for tibibits (1024^4)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "12390008765432", "11.27 Tib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例17: test_byotta
def test_byotta(fx_mchk):
"""
Test 'mag' for tibibits (1024^8)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "39423487271233986700065432", "32.61 Yib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例18: test_peta
def test_peta(fx_mchk):
"""
Test 'mag' for terabits (1000^5)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "17239090087685432", "17.24 Pb"
fx_mchk.result = mag.main([fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例19: test_kilo
def test_kilo(fx_mchk):
"""
Test 'mag' for bits (1000^0)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "98765", "98.77 Kb"
fx_mchk.result = mag.main([fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
示例20: test_bpeta
def test_bpeta(fx_mchk):
"""
Test 'mag' for tibibits (1024^5)
"""
pytest.debug_func()
fx_mchk.inp, fx_mchk.exp = "71233986700065432", "63.27 Pib"
fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
开发者ID:tbarron,项目名称:backscratcher,代码行数:7,代码来源:test_mag.py
注:本文中的pytest.debug_func函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论