本文整理汇总了Python中nose.SkipTest方法的典型用法代码示例。如果您正苦于以下问题:Python nose.SkipTest方法的具体用法?Python nose.SkipTest怎么用?Python nose.SkipTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nose
的用法示例。
在下文中一共展示了nose.SkipTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hammer_controller_rr_tracer
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_hammer_controller_rr_tracer():
try:
import trraces
except ImportError:
raise nose.SkipTest('need trraces')
build_docker()
t = archr.targets.DockerImageTarget('rex_tests:hammer_controller').build().start()
tb = archr.arsenal.RRTracerBow(t, local_trace_dir='/tmp/rex_hammer_controller_trace', symbolic_fd=0)
crash = rex.Crash(t, b"\x41"*120 + b'\n', aslr=False, tracer_bow=tb)
exploit = crash.exploit()
assert 'rop_chess_control' in exploit.arsenal
exploit.arsenal['rop_chess_control'].script()
exploit.arsenal['rop_chess_control'].script("x2.py")
示例2: skip
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def skip(reason):
def decorator(test_item):
if not hasattr(test_item, '__name__') and has_pytest:
return pytest.mark.skip(reason)
if not isinstance(test_item, SKIP_TYPES):
@functools.wraps(test_item)
def skip_wrapper(*args, **kwargs):
raise SkipTest(reason)
test_item = skip_wrapper
test_item.__unittest_skip__ = True
test_item.__unittest_skip_why__ = reason
return test_item
return decorator
示例3: test_geocode
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_geocode(self):
try:
result = cesiumpy.geocode._maybe_geocode('Los Angeles')
self.assertEqual(result, (-118.2436849, 34.0522342))
result = cesiumpy.geocode._maybe_geocode(['Los Angeles', 'Las Vegas'])
self.assertEqual(result, [(-118.2436849, 34.0522342), (-115.1398296, 36.1699412)])
result = cesiumpy.geocode._maybe_geocode(['Los Angeles', 'Las Vegas', [1, 2]])
self.assertEqual(result, [(-118.2436849, 34.0522342), (-115.1398296, 36.1699412), [1, 2]])
# do not convert
result = cesiumpy.geocode._maybe_geocode(3)
self.assertEqual(result, 3)
result = cesiumpy.geocode._maybe_geocode('xxxxx_str_unable_to_be_converted_xxxxxx')
self.assertEqual(result, 'xxxxx_str_unable_to_be_converted_xxxxxx')
except geopy.exc.GeocoderQuotaExceeded:
raise nose.SkipTest("exceeded geocoder quota")
示例4: test_viewer
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_viewer(self):
try:
viewer = cesiumpy.Viewer(divid='viewertest')
cyl = cesiumpy.Cylinder(position='Los Angeles', length=30000, topRadius=10000,
bottomRadius=10000, material='AQUA')
viewer.entities.add(cyl)
viewer.camera.flyTo('Los Angeles')
result = viewer.to_html()
exp = """<script src="https://cesiumjs.org/Cesium/Build/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="https://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css" type="text/css">
<div id="viewertest" style="width:100%; height:100%;"><div>
<script type="text/javascript">
var widget = new Cesium.Viewer("viewertest");
widget.entities.add({position : Cesium.Cartesian3.fromDegrees(-118.2436849, 34.0522342, 0.0), cylinder : {length : 30000.0, topRadius : 10000.0, bottomRadius : 10000.0, material : Cesium.Color.AQUA}});
widget.camera.flyTo({destination : Cesium.Cartesian3.fromDegrees(-118.2436849, 34.0522342, 100000.0)});
</script>"""
self.assertEqual(result, exp)
except geopy.exc.GeocoderQuotaExceeded:
raise nose.SkipTest("exceeded geocoder quota")
示例5: setup_class
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def setup_class(cls):
if not search.is_available():
raise nose.SkipTest('Solr not reachable')
cls.solr_client = search.make_connection()
cls.fq = " +site_id:\"%s\" " % config['ckan.site_id']
cls.package_index = search.PackageSearchIndex()
cls.base_package_dict = {
'id': 'test-index',
'name': 'monkey',
'title': 'Monkey',
'state': 'active',
'private': False,
'type': 'dataset',
'owner_org': None,
'metadata_created': datetime.datetime.now().isoformat(),
'metadata_modified': datetime.datetime.now().isoformat(),
}
示例6: setup_class
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def setup_class(cls):
if not tests.is_datastore_supported():
raise nose.SkipTest("Datastore not supported")
p.load('datastore')
ctd.CreateTestData.create()
cls.sysadmin_user = model.User.get('testsysadmin')
cls.normal_user = model.User.get('annafan')
resource = model.Package.get('annakarenina').resources[0]
cls.data = {
'resource_id': resource.id,
'aliases': u'b\xfck2',
'fields': [{'id': 'book', 'type': 'text'},
{'id': 'author', 'type': 'text'},
{'id': 'rating with %', 'type': 'text'}],
'records': [{'book': 'annakarenina', 'author': 'tolstoy',
'rating with %': '90%'},
{'book': 'warandpeace', 'author': 'tolstoy',
'rating with %': '42%'}]
}
engine = db._get_engine(
{'connection_url': config['ckan.datastore.write_url']})
cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine))
set_url_type(
model.Package.get('annakarenina').resources, cls.sysadmin_user)
示例7: setup_class
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def setup_class(cls):
if not config.get('ckan.datastore.read_url'):
raise nose.SkipTest('Datastore runs on legacy mode, skipping...')
engine = db._get_engine(
{'connection_url': config['ckan.datastore.write_url']}
)
cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine))
datastore_test_helpers.clear_db(cls.Session)
create_tables = [
u'CREATE TABLE test_a (id_a text)',
u'CREATE TABLE test_b (id_b text)',
u'CREATE TABLE "TEST_C" (id_c text)',
u'CREATE TABLE test_d ("α/α" integer)',
]
for create_table_sql in create_tables:
cls.Session.execute(create_table_sql)
示例8: test_ValidGzipFile
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_ValidGzipFile(self):
try:
import gzip
except ImportError:
# We don't have the gzip capabilities to test.
import nose
raise nose.SkipTest
# Test datasource's internal file_opener for Gzip files.
filepath = os.path.join(self.tmpdir, 'foobar.txt.gz')
fp = gzip.open(filepath, 'w')
fp.write(magic_line)
fp.close()
fp = self.ds.open(filepath)
result = fp.readline()
fp.close()
self.assertEqual(magic_line, result)
示例9: test_ValidBz2File
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_ValidBz2File(self):
try:
import bz2
except ImportError:
# We don't have the bz2 capabilities to test.
import nose
raise nose.SkipTest
# Test datasource's internal file_opener for BZip2 files.
filepath = os.path.join(self.tmpdir, 'foobar.txt.bz2')
fp = bz2.BZ2File(filepath, 'w')
fp.write(magic_line)
fp.close()
fp = self.ds.open(filepath)
result = fp.readline()
fp.close()
self.assertEqual(magic_line, result)
示例10: test_skip_functions_hardcoded
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_skip_functions_hardcoded():
@dec.skipif(True)
def f1(x):
raise DidntSkipException
try:
f1('a')
except DidntSkipException:
raise Exception('Failed to skip')
except nose.SkipTest:
pass
@dec.skipif(False)
def f2(x):
raise DidntSkipException
try:
f2('a')
except DidntSkipException:
pass
except nose.SkipTest:
raise Exception('Skipped when not expected to')
示例11: skip
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def skip(msg=None):
"""Decorator factory - mark a test function for skipping from test suite.
Parameters
----------
msg : string
Optional message to be added.
Returns
-------
decorator : function
Decorator, which, when applied to a function, causes SkipTest
to be raised, with the optional message added.
"""
return skipif(True,msg)
示例12: monkeypatch_xunit
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def monkeypatch_xunit():
try:
knownfailureif(True)(lambda: None)()
except Exception as e:
KnownFailureTest = type(e)
def addError(self, test, err, capt=None):
if issubclass(err[0], KnownFailureTest):
err = (SkipTest,) + err[1:]
return self.orig_addError(test, err, capt)
Xunit.orig_addError = Xunit.addError
Xunit.addError = addError
#-----------------------------------------------------------------------------
# Logic for skipping doctests
#-----------------------------------------------------------------------------
示例13: test_binary_operators
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def test_binary_operators(self):
# skipping for now #####
raise nose.SkipTest("skipping sparse binary operators test")
def _check_inplace_op(iop, op):
tmp = self.bseries.copy()
expected = op(tmp, self.bseries)
iop(tmp, self.bseries)
assert_sp_series_equal(tmp, expected)
inplace_ops = ['add', 'sub', 'mul', 'truediv', 'floordiv', 'pow']
for op in inplace_ops:
_check_inplace_op(
getattr(operator, "i%s" % op), getattr(operator, op))
示例14: setup_module
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def setup_module(module):
from nose import SkipTest
try:
import numpy
except ImportError:
raise SkipTest("numpy is required for nltk.metrics.segmentation")
示例15: setup_module
# 需要导入模块: import nose [as 别名]
# 或者: from nose import SkipTest [as 别名]
def setup_module(module):
from nose import SkipTest
try:
tagger = Senna('/usr/share/senna-v2.0', ['pos', 'chk', 'ner'])
except OSError:
raise SkipTest("Senna executable not found")