How to use _installopts method in tox

Best Python code snippet using tox_python

_venv.py

Source:_venv.py Github

copy

Full Screen

...230 depinfo = ", ".join(map(str, deps))231 action.setactivity("installdeps",232 "%s" % depinfo)233 self._install(deps, action=action)234 def _installopts(self, indexserver):235 l = []236 if indexserver:237 l += ["-i", indexserver]238 if self.envconfig.downloadcache:239 self.envconfig.downloadcache.ensure(dir=1)240 l.append("--download-cache=%s" % self.envconfig.downloadcache)241 return l242 def run_install_command(self, packages, options=(),243 indexserver=None, action=None,244 extraenv=None):245 argv = self.envconfig.install_command[:]246 # use pip-script on win32 to avoid the executable locking247 i = argv.index('{packages}')248 argv[i:i+1] = packages249 if '{opts}' in argv:250 i = argv.index('{opts}')251 argv[i:i+1] = list(options)252 for x in ('PIP_RESPECT_VIRTUALENV', 'PIP_REQUIRE_VIRTUALENV'):253 try:254 del os.environ[x]255 except KeyError:256 pass257 env = dict(PYTHONIOENCODING='utf_8')258 if extraenv is not None:259 env.update(extraenv)260 self._pcall(argv, cwd=self.envconfig.config.toxinidir,261 extraenv=env, action=action)262 def _install(self, deps, extraopts=None, action=None):263 if not deps:264 return265 d = {}266 l = []267 for dep in deps:268 if isinstance(dep, (str, py.path.local)):269 dep = DepConfig(str(dep), None)270 assert isinstance(dep, DepConfig), dep271 if dep.indexserver is None:272 ixserver = self.envconfig.config.indexserver['default']273 else:274 ixserver = dep.indexserver275 d.setdefault(ixserver, []).append(dep.name)276 if ixserver not in l:277 l.append(ixserver)278 assert ixserver.url is None or isinstance(ixserver.url, str)279 for ixserver in l:280 if self.envconfig.config.option.sethome:281 extraenv = hack_home_env(282 homedir=self.envconfig.envtmpdir.join("pseudo-home"),283 index_url = ixserver.url)284 else:285 extraenv = {}286 packages = d[ixserver]287 options = self._installopts(ixserver.url)288 if extraopts:289 options.extend(extraopts)290 self.run_install_command(packages=packages, options=options,291 action=action, extraenv=extraenv)292 def _getenv(self, extraenv={}):293 env = os.environ.copy()294 setenv = self.envconfig.setenv295 if setenv:296 env.update(setenv)297 env.update(extraenv)298 return env299 def test(self, redirect=False):300 action = self.session.newaction(self, "runtests")301 with action:...

Full Screen

Full Screen

venv.py

Source:venv.py Github

copy

Full Screen

...222 if deps:223 depinfo = ", ".join(map(str, deps))224 action.setactivity("installdeps", "%s" % depinfo)225 self._install(deps, action=action)226 def _installopts(self, indexserver):227 l = []228 if indexserver:229 l += ["-i", indexserver]230 if self.envconfig.downloadcache:231 self.envconfig.downloadcache.ensure(dir=1)232 l.append("--download-cache=%s" % self.envconfig.downloadcache)233 if self.envconfig.pip_pre:234 l.append("--pre")235 return l236 def run_install_command(self, packages, options=(), action=None):237 argv = self.envconfig.install_command[:]238 # use pip-script on win32 to avoid the executable locking239 i = argv.index('{packages}')240 argv[i:i + 1] = packages241 if '{opts}' in argv:242 i = argv.index('{opts}')243 argv[i:i + 1] = list(options)244 for x in ('PIP_RESPECT_VIRTUALENV', 'PIP_REQUIRE_VIRTUALENV',245 '__PYVENV_LAUNCHER__'):246 os.environ.pop(x, None)247 old_stdout = sys.stdout248 sys.stdout = codecs.getwriter('utf8')(sys.stdout)249 self._pcall(argv, cwd=self.envconfig.config.toxinidir, action=action)250 sys.stdout = old_stdout251 def _install(self, deps, extraopts=None, action=None):252 if not deps:253 return254 deps_by_ixserver = {}255 ixservers = []256 for dep in deps:257 if isinstance(dep, (str, py.path.local)):258 dep = DepConfig(str(dep), None)259 assert isinstance(dep, DepConfig), dep260 if dep.indexserver is None:261 ixserver = self.envconfig.config.indexserver['default']262 else:263 ixserver = dep.indexserver264 deps_by_ixserver.setdefault(ixserver, []).append(dep.name)265 if ixserver not in ixservers:266 ixservers.append(ixserver)267 assert ixserver.url is None or isinstance(ixserver.url, str)268 for ixserver in ixservers:269 packages = deps_by_ixserver[ixserver]270 options = self._installopts(ixserver.url)271 if extraopts:272 options.extend(extraopts)273 self.run_install_command(packages=packages, options=options,274 action=action)275 def _getenv(self, testcommand=False):276 if testcommand:277 # for executing tests we construct a clean environment278 env = {}279 for envname in self.envconfig.passenv:280 if envname in os.environ:281 env[envname] = os.environ[envname]282 else:283 # for executing non-test commands we use the full284 # invocation environment...

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