Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@py.test.mark.multi(name='test tests whatever .dotdir'.split())
def test_setinitial_conftest_subdirs(testdir, name):
sub = testdir.mkdir(name)
subconftest = sub.ensure("conftest.py")
conftest = Conftest()
conftest.setinitial([sub.dirpath(), '--confcutdir=%s' % testdir.tmpdir])
if name not in ('whatever', '.dotdir'):
assert subconftest in conftest._conftestpath2mod
assert len(conftest._conftestpath2mod) == 1
else:
assert subconftest not in conftest._conftestpath2mod
assert len(conftest._conftestpath2mod) == 0
def test_missing_system_plugin():
config['system_plugins'] = ['missingplugin']
with py.test.raises(ImportError):
serve.load_app()
config['system_plugins'] = []
char32_t foo_4bytes(char32_t);
""")
lib = verify(ffi, "test_char16_char32_type" + no_cpp * "_nocpp", """
#if !defined(__cplusplus) || (!defined(_LIBCPP_VERSION) && __cplusplus < 201103L)
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
#endif
char16_t foo_2bytes(char16_t a) { return (char16_t)(a + 42); }
char32_t foo_4bytes(char32_t a) { return (char32_t)(a + 42); }
""", no_cpp=no_cpp)
assert lib.foo_2bytes(u+'\u1234') == u+'\u125e'
assert lib.foo_4bytes(u+'\u1234') == u+'\u125e'
assert lib.foo_4bytes(u+'\U00012345') == u+'\U0001236f'
py.test.raises(TypeError, lib.foo_2bytes, u+'\U00012345')
py.test.raises(TypeError, lib.foo_2bytes, 1234)
py.test.raises(TypeError, lib.foo_4bytes, 1234)
def setup_class(cls):
cls.View = py.test.importorskip("py._code._assertionold").View
def test_check_incompatible():
py.test.raises(ValueError, "relpath('/a', 'b')")
def test_simple_put():
user = User('cdent', note='foo')
user.set_password('cowpig')
user.add_role('ADMIN')
user.add_role('BOSS')
store.put(user)
if type(store.storage) != tiddlyweb.stores.text.Store:
py.test.skip('skipping this test for non-text store')
assert os.path.exists(expected_stored_filename)
@py.test.mark.xfail("implement socketserver test scenario")
def test_socketgateway(self):
gw = py.execnet.PopenGateway()
spec = py.execnet.GatewaySpec("ssh:" + sshhost)
def test_apigen_functional():
#if py.std.sys.platform == "win32":
# py.test.skip("XXX test fails on windows")
fs_root, package_name = setup_fs_project('test_apigen_functional')
tempdir = py.test.ensuretemp('test_apigen_functional_results')
pydir = py.magic.autopath().dirpath().dirpath().dirpath()
pakdir = fs_root.join('pak')
if py.std.sys.platform == 'win32':
cmd = ('set APIGENPATH=%s && set PYTHONPATH=%s && '
'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
else:
cmd = ('APIGENPATH="%s" PYTHONPATH="%s" '
'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
try:
output = py.process.cmdexec('%s --apigen="%s/apigen.py" "%s"' % (
cmd, fs_root, pakdir))
except py.error.Error, e:
print e.out
raise
assert output.lower().find('traceback') == -1
def parse_error(input, expected_msg, expected_location):
e = py.test.raises(ParseError, parse, input)
assert e.value.args[0] == expected_msg
assert e.value.args[1] == expected_location
def restcheck(self, path):
py.test.importorskip("docutils")
self.register_linkrole()
from docutils.utils import SystemMessage
try:
self._checkskip(path, self.project.get_htmloutputpath(path))
self.project.process(path)
except KeyboardInterrupt:
raise
except SystemMessage:
# we assume docutils printed info on stdout
py.test.fail("docutils processing failed, see captured stderr")