Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_gpkg_22(tile_drv_name='PNG'):
if gdaltest.gpkg_dr is None:
pytest.skip()
if tile_drv_name is None:
tile_drv = gdaltest.png_dr
if gdaltest.jpeg_dr is None:
pytest.skip()
expected_cs = [2466, 10807]
clamped_expected_cs = [1989, 1989, 1989, 11580]
if tile_drv_name == 'PNG':
tile_drv = gdaltest.png_dr
expected_cs = [1970, 10807]
clamped_expected_cs = [2100, 2100, 2100, 11580]
elif tile_drv_name == 'JPEG':
tile_drv = gdaltest.jpeg_dr
expected_cs = [6782, 32706]
clamped_expected_cs = [6538, 6538, 6538, 32744]
elif tile_drv_name == 'WEBP':
tile_drv = gdaltest.webp_dr
def test_ospf6_link_down():
"Test OSPF6 daemon convergence after link goes down"
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip('skipped because of router(s) failure')
for rnum in range(1, 5):
router = 'r{}'.format(rnum)
logger.info('Waiting for router "%s" IPv6 OSPF convergence after link down', router)
# Load expected results from the command
reffile = os.path.join(CWD, '{}/ospf6route_down.txt'.format(router))
expected = open(reffile).read()
# Run test function until we get an result. Wait at most 60 seconds.
test_func = partial(compare_show_ipv6_ospf6, router, expected)
result, diff = topotest.run_and_expect(test_func, '',
count=25, wait=3)
assert result, 'OSPF6 did not converge on {}:\n{}'.format(router, diff)
def test_process_passed() -> None:
try:
result = process_devices(
{
MOCK
}, 'passed')
assert result[0]['consumer'] == 'razer_chroma'
assert result[0]['type'] == 'device'
assert result[0]['name']
assert result[0]['status'] == 'passed'
except:
pytest.skip()
# Copyright: 2009 MoinMoin:ThomasWaldmann
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
"""
MoinMoin - Test - FlatFileBackend
"""
import pytest
pytest.skip("BackendTest base class tests quite some stuff that this very simple backend does not provide")
# e.g.: revisioning, extremely long item names, metadata support
# TODO: either fix base class so that it is more useful even to test simple backends,
# or implement some specific, more simple tests here.
import tempfile, shutil
from MoinMoin.storage._tests.test_backends import BackendTest
from MoinMoin.storage.backends.flatfile import FlatFileBackend
class TestFlatFileBackend(BackendTest):
def create_backend(self):
self.tempdir = tempfile.mkdtemp('', 'moin-')
return FlatFileBackend(self.tempdir)
def kill_backend(self):
def test_examples(frontend, f):
# Test the examples with all available front-ends
print('frontend = %s. f = %s' % (frontend, f))
if not frontends[frontend]:
pytest.skip('%s is not installed. Skipping tests' % frontend)
utils.testFile(f[0], f[1], utils.sys.executable, frontend)
version_list = params_from_base_test_setup["version_list"]
base_url_list = server_setup["base_url_list"]
cbl_db_server = server_setup["cbl_db_server"]
cbl_db_list = server_setup["cbl_db_list"]
channels = ["peerToPeer"]
base_url_client = base_url_list[1]
replicator = Replication(base_url_client)
p2p_client = PeerToPeer(base_url_client)
db_obj_server = db_obj_list[0]
cbl_db_client = cbl_db_list[1]
db_obj_client = db_obj_list[1]
db_name_server = db_name_list[0]
if meet_supported_version(version_list, "2.5.0") is False:
pytest.skip("Filtering feature is available only onwards CBL 2.5.0")
server_host = host_list[0]
if attachments:
db_obj_client.create_bulk_docs(num_of_docs, "replication", db=cbl_db_client, channels=channels,
attachments_generator=attachment.generate_png_100_100)
else:
db_obj_client.create_bulk_docs(num_of_docs, "replication", db=cbl_db_client, channels=channels)
# Now set up client
repl_config = p2p_client.configure(host=server_host, server_db_name=db_name_server,
client_database=cbl_db_client, continuous=False,
replication_type="push_pull", endPointType=endpoint_type)
replicator.start(repl_config)
replicator.wait_until_replicator_idle(repl_config)
total = replicator.getTotal(repl_config)
completed = replicator.getCompleted(repl_config)
def test_concat_mixed_dtypes(self, data, dtype):
if dtype.name in ["fletcher[int64]", "fletcher[double]", "fletcher[bool]"]:
# https://github.com/pandas-dev/pandas/issues/21792
pytest.skip("pd.concat(int64, fletcher[int64] yields int64")
else:
BaseReshapingTests.test_concat_mixed_dtypes(self, data)
def test_rasterlite_12():
if gdaltest.rasterlite_drv is None:
pytest.skip()
if gdaltest.has_spatialite is False:
pytest.skip()
ds = gdal.Open('data/byte.rasterlite')
assert ds.GetRasterBand(1).Checksum() == 4672, 'validation failed'
def test_lz4f(self):
if platform.python_implementation() == "PyPy":
pytest.skip("lz4f is currently unsupported with PyPy")
encoded = lz4f.compressFrame(self.text)
self.assertNotEqual(self.text, encoded)
decoded = compression.decode_lz4f(encoded)
self.assertEqual(self.text, decoded)
def test_vsiaz_extra_1():
if not gdaltest.built_against_curl():
pytest.skip()
az_resource = gdal.GetConfigOption('AZ_RESOURCE')
if az_resource is None:
pytest.skip('Missing AZ_RESOURCE')
if '/' not in az_resource:
path = '/vsiaz/' + az_resource
statres = gdal.VSIStatL(path)
assert statres is not None and stat.S_ISDIR(statres.mode), \
('%s is not a valid bucket' % path)
readdir = gdal.ReadDir(path)
assert readdir is not None, 'ReadDir() should not return empty list'
for filename in readdir:
if filename != '.':
subpath = path + '/' + filename