Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_gtm_datacenter import ApiParameters
from library.modules.bigip_gtm_datacenter import ModuleParameters
from library.modules.bigip_gtm_datacenter import ModuleManager
from library.modules.bigip_gtm_datacenter import ArgumentSpec
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_apm_policy_fetch import ApiParameters
from library.modules.bigip_apm_policy_fetch import ModuleParameters
from library.modules.bigip_apm_policy_fetch import ModuleManager
from library.modules.bigip_apm_policy_fetch import ArgumentSpec
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
@pytest.mark.skip(reason='not supported with QASetting generators.')
def test_variable_duplication():
tokenizer = nltk.tokenize.WordPunctTokenizer()
pipeline_folder = 'test_pipeline'
base_path = join(get_data_path(), pipeline_folder)
batch_size = 32
func = lambda x: [word[0:2] for word in x]
# clean all data from previous failed tests
if os.path.exists(base_path):
shutil.rmtree(base_path)
s = DatasetStreamer(input_keys=['input', 'support', 'target'], output_keys=['input', 'support', 'target', 'input'])
s.set_path(get_test_data_path_dict()['snli'])
s.add_stream_processor(JsonLoaderProcessors())
# 1. Setup pipeline to save lengths and generate vocabulary
keys = ['input', 'support', 'target', 'input_pos']
p = Pipeline(pipeline_folder, keys=keys)
@pytest.mark.skip
def test_12_add__guess(self):
mock_open(read_data='1\n')
with patch('sys.stdin', mock_open):
self.action_add(namespace=self.local_namespace,
repository='git-repo',
alone=True,
tracking='github',
auto_slug=True,
remotes={
'origin': 'https://github.com/foo/bar',
'wootwoot': 'git@github.com:w00t/w00t',
'duckling': 'ssh://github.com/duck/duck',
}
@pytest.mark.skip(
reason="May trigger a bug on some device, see github issue #564.")
def test_image_0003_spirvopt_android_amber(tmp_path: pathlib2.Path):
check_images_match_spirvopt(tmp_path, 'image_test_0003.json',
options='-O',
is_android=True,
is_amber=True)
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_profile_server_ssl import ApiParameters
from library.modules.bigip_profile_server_ssl import ModuleParameters
from library.modules.bigip_profile_server_ssl import ModuleManager
from library.modules.bigip_profile_server_ssl import ArgumentSpec
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
@pytest.mark.skip(reason="fails pending support for different recruiters")
def test_submitted_hit_shows_thanks_page_in_sandbox(self, a, webapp, active_config):
active_config.extend({"mode": u"sandbox"})
p = a.participant()
p.status = u"submitted"
resp = webapp.get(
"/ad?hitId={}&assignmentId={}&workerId={}".format(
p.hit_id, p.assignment_id, p.worker_id
)
)
assert b"To complete the HIT, simply press the button below." in resp.data
@pytest.mark.skip(reason="cluster_analysis_search=True not implemented")
def test_index_trypsin_two_lattice(dials_regression, tmpdir):
# synthetic trypsin multi-lattice dataset (2 lattices)
data_dir = os.path.join(dials_regression, "indexing_test_data", "trypsin")
pickle_path = os.path.join(data_dir, "P1_X6_1_2.pickle")
sweep_path = os.path.join(data_dir, "experiments_P1_X6_1_2.json")
extra_args = [
"cluster_analysis_search=True",
"reflections_per_degree=10",
"n_macro_cycles=2",
"reciprocal_space_grid.d_min=4",
"max_cell=70",
"image_range=0,50",
"image_range=450,500",
"image_range=850,900",
"max_lattices=2",
]
@pytest.mark.skip(reason='see cds#618 comments')
def test_celery():
"""Test celery application."""
from cds.celery import celery
celery.loader.import_default_modules()
assert 'invenio_mail.tasks.send_email' in celery.tasks
assert 'invenio_records.tasks.api.create_record' in celery.tasks