Best Python code snippet using tox_python
test_conda_env.py
Source:test_conda_env.py
...11 )12 venv = VirtualEnv(config.envconfigs["py123"], session=mocksession)13 assert venv.path == config.envconfigs['py123'].envdir14 action = mocksession.newaction(venv, "getenv")15 tox_testenv_create(action=action, venv=venv)16 pcalls = mocksession._pcalls17 assert len(pcalls) == 118 assert 'conda' in pcalls[0].args[0]19 assert 'create' == pcalls[0].args[1]20 assert '--yes' == pcalls[0].args[2]21 assert '-p' == pcalls[0].args[3]22 assert venv.path == pcalls[0].args[4]23 assert pcalls[0].args[5].startswith('python=')24def create_test_env(config, mocksession, envname):25 venv = VirtualEnv(config.envconfigs[envname], session=mocksession)26 action = mocksession.newaction(venv, "getenv")27 tox_testenv_create(action=action, venv=venv)28 pcalls = mocksession._pcalls29 assert len(pcalls) == 130 pcalls[:] = []31 return venv, action, pcalls32def test_install_deps_no_conda(newconfig, mocksession):33 '''Test installation using conda when no conda_deps are given'''34 config = newconfig(35 [],36 """37 [testenv:py123]38 deps=39 numpy40 astropy41 """,...
test_tox_pipenv-install.py
Source:test_tox_pipenv-install.py
...12 """,13 )14 venv = mocksession.getvenv("py123")15 with mocksession.newaction(venv.name, "getenv") as action: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)...
test_testenv_create.py
Source:test_testenv_create.py
...6def test_pcall(venv, mocker, actioncls):7 action = actioncls()8 mocker.patch.object(os, "environ", autospec=True)9 mocker.patch("subprocess.Popen")10 result = tox_testenv_create(venv, action)11 assert result == True12 # Check that pipenv was executed with the correct arguments13 subprocess.Popen.assert_called_once_with(14 [sys.executable, "-m", "pipenv", "--python", "test-python"],15 action=action,16 cwd=venv.path.dirpath(),17 venv=False,18 )19 assert venv.tmpdir.ensure("Pipfile")20def test_pcall_sitepackages(venv, mocker, actioncls):21 """22 Check that the sitepackages configuration in tox is passed to pipenv23 """24 action = actioncls()25 mocker.patch.object(os, "environ", autospec=True)26 mocker.patch("subprocess.Popen")27 venv.envconfig.sitepackages = True28 result = tox_testenv_create(venv, action)29 assert result == True30 # Check that pipenv was executed with the correct arguments31 subprocess.Popen.assert_called_once_with(32 [sys.executable, "-m", "pipenv", "--site-packages", "--python", "test-python"],33 action=action,34 cwd=venv.path.dirpath(),35 venv=False,36 )...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!