How to use syspath_append method in Behave

Best Python code snippet using behave

settings.py

Source:settings.py Github

copy

Full Screen

...5import utils6DEBUG = True7TEMPLATE_DEBUG = DEBUG8ROOT = os.path.abspath(os.path.dirname(__file__))9def syspath_append(pathlist):10 for path in pathlist:11 abspath = os.path.normpath(os.path.join(ROOT, path))12 sys.path.insert(0, abspath)13 14PATH_LIST = ['../','../packages','../shared','../djangoapps']15syspath_append(PATH_LIST)16utils.set_root(ROOT)17ADMINS = (18 # ('Your Name', 'your_email@example.com'),19)20MANAGERS = ADMINS21DATABASES = {22 'default': {23 'ENGINE': utils.get_setting('DATABASE_ENGINE'), # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.24 'NAME': utils.get_setting('DATABASE_NAME'), # Or path to database file if using sqlite3.25 'USER': utils.get_setting('DATABASE_USER') , # Not used with sqlite3.26 'PASSWORD': utils.get_setting('DATABASE_PASSWORD') , # Not used with sqlite3.27 'HOST': utils.get_setting('DATABASE_HOST') , # Set to empty string for localhost. Not used with sqlite3.28 'PORT': utils.get_setting('DATABASE_PORT'), # Set to empty string for default. Not used with sqlite3.29 }...

Full Screen

Full Screen

_setup.py

Source:_setup.py Github

copy

Full Screen

...42 bundle_path = os.path.relpath(INVOKE_BUNDLE, os.getcwd())43 print("USING: %s (version: %s)" % (bundle_path, invoke.__version__))44 else:45 # -- BEST-EFFORT: May rescue something46 syspath_append(os.path.abspath(TASKS_VENDOR_DIR))47 setup_path_for_bundle(INVOKE_BUNDLE, pos=len(sys.path))48 if DEBUG_SYSPATH:49 for index, p in enumerate(sys.path):50 print(" %d. %s" % (index, p))51def require_invoke_minversion(min_version, verbose=False):52 """Ensures that :mod:`invoke` has at the least the :param:`min_version`.53 Otherwise,54 :param min_version: Minimal acceptable invoke version (as string).55 :param verbose: Indicates if invoke.version should be shown.56 :raises: VersionRequirementError=SystemExit if requirement fails.57 """58 # -- REQUIRES: sys.path is setup and contains invoke59 try:60 import invoke61 invoke_version = invoke.__version__62 except ImportError:63 invoke_version = "__NOT_INSTALLED"64 if invoke_version < min_version:65 message = "REQUIRE: invoke.version >= %s (but was: %s)" % \66 (min_version, invoke_version)67 message += "\nUSE: pip install invoke>=%s" % min_version68 raise VersionRequirementError(message)69 # pylint: disable=invalid-name70 INVOKE_VERSION = os.environ.get("INVOKE_VERSION", None)71 if verbose and not INVOKE_VERSION:72 os.environ["INVOKE_VERSION"] = invoke_version73 print("USING: invoke.version=%s" % invoke_version)74def need_vendor_bundles(invoke_minversion=None):75 invoke_minversion = invoke_minversion or "0.0.0"76 need_vendor_answers = []77 need_vendor_answers.append(need_vendor_bundle_invoke(invoke_minversion))78 # -- REQUIRE: path.py79 try:80 import path81 need_bundle = False82 except ImportError:83 need_bundle = True84 need_vendor_answers.append(need_bundle)85 # -- DIAG: print("INVOKE: need_bundle=%s" % need_bundle1)86 # return need_bundle1 or need_bundle287 return any(need_vendor_answers)88def need_vendor_bundle_invoke(invoke_minversion="0.0.0"):89 # -- REQUIRE: invoke90 try:91 import invoke92 need_bundle = invoke.__version__ < invoke_minversion93 if need_bundle:94 del sys.modules["invoke"]95 del invoke96 except ImportError:97 need_bundle = True98 except Exception: # pylint: disable=broad-except99 need_bundle = True100 return need_bundle101# -----------------------------------------------------------------------------102# UTILITY FUNCTIONS:103# -----------------------------------------------------------------------------104def setup_path_for_bundle(bundle_path, pos=0):105 if os.path.exists(bundle_path):106 syspath_insert(pos, os.path.abspath(bundle_path))107 return True108 return False109def syspath_insert(pos, path):110 if path in sys.path:111 sys.path.remove(path)112 sys.path.insert(pos, path)113def syspath_append(path):114 if path in sys.path:115 sys.path.remove(path)...

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 Behave 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