How to use tox_testenv_install_deps method in tox

Best Python code snippet using tox_python

test_conda_env.py

Source:test_conda_env.py Github

copy

Full Screen

...42 )43 venv, action, pcalls = create_test_env(config, mocksession, 'py123')44 assert len(venv.envconfig.deps) == 245 assert len(venv.envconfig.conda_deps) == 046 tox_testenv_install_deps(action=action, venv=venv)47 assert len(pcalls) == 148 cmd = pcalls[0].args49 assert cmd[1:4] == ['-m', 'pip', 'install']50def test_install_conda_deps(newconfig, mocksession):51 config = newconfig(52 [],53 """54 [testenv:py123]55 deps=56 numpy57 astropy58 conda_deps=59 pytest60 asdf61 """,62 )63 venv, action, pcalls = create_test_env(config, mocksession, 'py123')64 assert len(venv.envconfig.conda_deps) == 265 assert len(venv.envconfig.deps) == 2 + len(venv.envconfig.conda_deps)66 tox_testenv_install_deps(action=action, venv=venv)67 # We expect two calls: one for conda deps, and one for pip deps68 assert len(pcalls) == 269 conda_cmd = pcalls[0].args70 assert 'conda' in os.path.split(conda_cmd[0])[-1]71 assert conda_cmd[1:5] == ['install', '--yes', '-p', venv.path]72 # Make sure that python is explicitly given as part of every conda install73 # in order to avoid inadvertant upgrades of python itself.74 assert conda_cmd[5].startswith('python=')75 assert conda_cmd[6:8] == ['pytest', 'asdf']76 pip_cmd = pcalls[1].args77 assert pip_cmd[1:4] == ['-m', 'pip', 'install']78 assert pip_cmd[4:6] == ['numpy', 'astropy']79def test_install_conda_no_pip(newconfig, mocksession):80 config = newconfig(81 [],82 """83 [testenv:py123]84 conda_deps=85 pytest86 asdf87 """,88 )89 venv, action, pcalls = create_test_env(config, mocksession, 'py123')90 assert len(venv.envconfig.conda_deps) == 291 assert len(venv.envconfig.deps) == len(venv.envconfig.conda_deps)92 tox_testenv_install_deps(action=action, venv=venv)93 # We expect only one call since there are no true pip dependencies94 assert len(pcalls) == 195 # Just a quick sanity check for the conda install command96 conda_cmd = pcalls[0].args97 assert 'conda' in os.path.split(conda_cmd[0])[-1]98 assert conda_cmd[1:5] == ['install', '--yes', '-p', venv.path]99def test_update(tmpdir, newconfig, mocksession):100 pkg = tmpdir.ensure("package.tar.gz")101 config = newconfig(102 [],103 """104 [testenv:py123]105 deps=106 numpy107 astropy108 conda_deps=109 pytest110 asdf111 """,112 )113 venv, action, pcalls = create_test_env(config, mocksession, 'py123')114 tox_testenv_install_deps(action=action, venv=venv)115 venv.hook.tox_testenv_create = tox_testenv_create116 venv.hook.tox_testenv_install_deps = tox_testenv_install_deps117 action = mocksession.newaction(venv, "update")118 venv.update(action)...

Full Screen

Full Screen

test_testenv_install_deps.py

Source:test_testenv_install_deps.py Github

copy

Full Screen

...10 action = actioncls(venv)11 venv.deps = []12 mocker.patch.object(os, "environ", autospec=True)13 mocker.patch("subprocess.Popen")14 result = tox_testenv_install_deps(venv, action)15 assert result == True16 assert subprocess.Popen.call_count == 117 subprocess.Popen.assert_called_once_with(18 [19 sys.executable,20 "-m",21 "pipenv",22 "install",23 "--dev",24 ],25 action=action,26 cwd=venv.path.dirpath(),27 venv=False,28 )29def test_install_special_deps(venv, mocker, actioncls):30 """31 Test that nothing is called when there are no deps32 """33 action = actioncls(venv)34 venv.deps = ["foo-package", "foo-two-package"]35 mocker.patch.object(os, "environ", autospec=True)36 mocker.patch("subprocess.Popen")37 result = tox_testenv_install_deps(venv, action)38 assert result == True39 assert subprocess.Popen.call_count == 140 subprocess.Popen.assert_called_once_with(41 [42 sys.executable,43 "-m",44 "pipenv",45 "install",46 "--dev",47 "foo-package",48 "foo-two-package",49 ],50 action=action,51 cwd=venv.path.dirpath(),52 venv=False,53 )54def test_install_pip_pre_deps(venv, mocker, actioncls):55 """56 Test that nothing is called when there are no deps57 """58 action = actioncls(venv)59 venv.deps = ["foo-package", "foo-two-package"]60 mocker.patch.object(os, "environ", autospec=True)61 mocker.patch.object(action.venv.envconfig, 'pip_pre', True)62 mocker.patch("subprocess.Popen")63 result = tox_testenv_install_deps(venv, action)64 assert result == True65 assert subprocess.Popen.call_count == 166 subprocess.Popen.assert_called_once_with(67 [68 sys.executable,69 "-m",70 "pipenv",71 "install",72 "--dev",73 "--pre",74 "foo-package",75 "foo-two-package",76 ],77 action=action,...

Full Screen

Full Screen

test_tox_pipenv-install.py

Source:test_tox_pipenv-install.py Github

copy

Full Screen

...16 tox_testenv_create(action=action, venv=venv)17 pcalls = mocksession._pcalls18 assert len(pcalls) == 119 pcalls[:] = []20 tox_testenv_install_deps(action=action, venv=venv)21 assert len(pcalls) == 222 args = " ".join(pcalls[0].args)23 assert args.endswith('-m pip install dep1 pipenv')24 args = " ".join(pcalls[1].args)25 assert args.endswith('-m pipenv install --dev')26def test_install_deps_indexserver__without_deps(newmocksession):27 mocksession = newmocksession(28 [],29 """\30 [tox]31 [testenv:py123]32 """,33 )34 venv = mocksession.getvenv("py123")35 with mocksession.newaction(venv.name, "getenv") as action:36 tox_testenv_create(action=action, venv=venv)37 pcalls = mocksession._pcalls38 assert len(pcalls) == 139 pcalls[:] = []40 tox_testenv_install_deps(action=action, venv=venv)41 assert len(pcalls) == 242 args = " ".join(pcalls[0].args)43 assert args.endswith('-m pip install pipenv')44 args = " ".join(pcalls[1].args)...

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