How to use _ensure_module_in_paths method in tox

Best Python code snippet using tox_python

build_isolated.py

Source:build_isolated.py Github

copy

Full Screen

...4tarball.5"""6import os7import sys8def _ensure_module_in_paths(module, paths):9 """Verify that the imported backend belongs in-tree."""10 if not paths:11 return12 module_path = os.path.normcase(os.path.abspath(module.__file__))13 normalized_paths = (os.path.normcase(os.path.abspath(path)) for path in paths)14 if any(os.path.commonprefix((module_path, path)) == path for path in normalized_paths):15 return16 raise SystemExit(17 "build-backend ({!r}) must exist in one of the paths "18 "specified by backend-path ({!r})".format(module, paths),19 )20dist_folder = sys.argv[1]21backend_spec = sys.argv[2]22backend_obj = sys.argv[3] if len(sys.argv) >= 4 else None23backend_paths = sys.argv[4].split(os.path.pathsep) if sys.argv[4] else []24sys.path[:0] = backend_paths25backend = __import__(backend_spec, fromlist=["_trash"])26_ensure_module_in_paths(backend, backend_paths)27if backend_obj:28 backend = getattr(backend, backend_obj)29basename = backend.build_sdist(dist_folder, {"--global-option": ["--formats=gztar"]})...

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