How to use check_module method in prospector

Best Python code snippet using prospector_python

test_case.py

Source:test_case.py Github

copy

Full Screen

...7 code = open(md_path, 'r').read()8 else:9 code = config_path10 RestrictConfigParser().parse(code)11def check_module(md_path, error=False):12 if error:13 try:14 parse_config(md_path)15 raise Exception("[Not Meet] expecting exception, but no error")16 except InvalidETLConfig as ex:17 print("[Meet] got exception: ", ex)18 else:19 parse_config(md_path)20check_module('./restrict_config_test_data//config1_safe.py')21check_module('./restrict_config_test_data//config1_fail.py', True)22check_module('./restrict_config_test_data//config2_fail1.py', True)23check_module('./restrict_config_test_data//config2_fail2.py', True)24check_module('./restrict_config_test_data//config2_fail3.py', True)25check_module('./restrict_config_test_data//config3_safe.py')26check_module('./restrict_config_test_data//config3_fail.py', True)27check_module('./restrict_config_test_data//config4_safe.py')28check_module('./restrict_config_test_data//config5_safe.py')29check_module('./restrict_config_test_data//config6_safe.py')30check_module('./restrict_config_test_data//config7_safe.py')31code = """32import re33"""34check_module(code, True)35code = """36from aliyun.log.etl_core import V37"""38check_module(code, True)39code = """40from aliyun.log.etl_core import *41"""42check_module(code)43code = """44KEEP_FIELDS_f1 = {"abc": V("xyz")}45"""46check_module(code)47code = """48KEEP_FIELDS_f1 = {"abc".lower(): "xyz"}49"""50check_module(code, True)51code = """52KEEP_FIELDS_f1 = {"abc": lambda e: 'v' in e }53"""54check_module(code, True)55code = """56KEEP_FIELDS_f1 = {"abc": Y("x") }57"""58check_module(code, True)59c = """60DROP_FIELDS_v1 = {'k1': str.isdigit}61"""62check_module(c, True)63c = """64DROP_FIELDS_v2 = {'k3': lambda x: x.isupper()}65"""66check_module(c, True)67c = """68TRANSFORM_EVENT_v16 = lambda x: {'k3': 'abc123'}69"""70check_module(c, True)71c = """72KEEP_FIELDS_f1 = {"abc": "abc" + "xyz"}73"""74check_module(c, True)75c = """76KEEP_FIELDS_f1 = {"abc": f"abc{xyz}"}77"""78try:79 check_module(c, True)80except SyntaxError:81 pass82c = """83KEEP_FIELDS_f1 = {"abc": (1,2,lambda x:x)}84"""85check_module(c, True)86c = """87aliyun.log.etl_core.restrict_config_parser.RestrictConfigParser = None88"""89check_module(c, True)90c = """91KEEP_FIELDS_f1 = __import__("os")92"""93check_module(c, True)94c = """95KEEP_FIELDS_f1 = "abc".__class__96"""...

Full Screen

Full Screen

patch-configure.py

Source:patch-configure.py Github

copy

Full Screen

...3+++ configure.py4@@ -341,7 +341,7 @@ class ConfigurePyQt4:5 pyqt_modules.append("QtCore")6 7 check_module("QtGui", "qwidget.h", "new QWidget()")8- check_module("QtHelp", "qhelpengine.h", "new QHelpEngine(\"foo\")")9+ check_module("QtHelp", "qhelpengine.h", "new QHelpEngine(\"foo\")", extra_libs=["QtCore"])10 check_module("QtMultimedia", "QAudioDeviceInfo",11 "new QAudioDeviceInfo()")12 check_module("QtNetwork", "qhostaddress.h", "new QHostAddress()")13@@ -367,8 +367,8 @@ class ConfigurePyQt4:14 check_module("QtWebKit", "qwebpage.h", "new QWebPage()")15 check_module("QtXml", "qdom.h", "new QDomDocument()")16 check_module("QtXmlPatterns", "qxmlname.h", "new QXmlName()")17- check_module("phonon", "phonon/videowidget.h",18- "new Phonon::VideoWidget()")19+# check_module("phonon", "phonon/videowidget.h",20+# "new Phonon::VideoWidget()")21 check_module("QtAssistant", "qassistantclient.h",22 "new QAssistantClient(\"foo\")", extra_lib_dirs=ass_lib_dirs,23 extra_libs=ass_libs)24@@ -963,7 +963,7 @@ include(%s)25 26 config_args = ducfg.get("CONFIG_ARGS", "")27 28- if sys.platform == "darwin":29+ if False: # sys.platform == "darwin":30 dynamic_pylib = "--enable-framework" in config_args31 32 # It's probably a Python bug that the library name doesn't33@@ -1950,8 +1950,8 @@ def get_qt_configuration():34 else:35 exe_file = os.path.join("release", app + ".exe")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run prospector automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful