Best Python code snippet using tox_python
sequential.py
Source:sequential.py
...7 if venv.envconfig.skip_install:8 venv.finishvenv()9 else:10 if venv.envconfig.usedevelop:11 develop_pkg(venv, config.setupdir)12 elif config.skipsdist:13 venv.finishvenv()14 else:15 installpkg(venv, venv.package)16 if venv.status == 0:17 runenvreport(venv, config)18 if venv.status == 0:19 runtestenv(venv, config)20def develop_pkg(venv, setupdir):21 with venv.new_action("developpkg", setupdir) as action:22 try:23 venv.developpkg(setupdir, action)24 return True25 except InvocationError as exception:26 venv.status = exception27 return False28def installpkg(venv, path):29 """Install package in the specified virtual environment.30 :param VenvConfig venv: Destination environment31 :param str path: Path to the distribution package.32 :return: True if package installed otherwise False.33 :rtype: bool34 """...
test_develop.py
Source:test_develop.py
1"""develop tests2"""3import sys4import os, shutil, tempfile, unittest5import tempfile6import site7from StringIO import StringIO8from setuptools.command.develop import develop9from setuptools.command import develop as develop_pkg10from setuptools.dist import Distribution11SETUP_PY = """\12from setuptools import setup13setup(name='foo')14"""15class TestDevelopTest(unittest.TestCase):16 def setUp(self):17 self.dir = tempfile.mkdtemp()18 setup = os.path.join(self.dir, 'setup.py')19 f = open(setup, 'w')20 f.write(SETUP_PY)21 f.close()22 self.old_cwd = os.getcwd()23 os.chdir(self.dir)24 if sys.version >= "2.6":25 self.old_base = site.USER_BASE26 site.USER_BASE = develop_pkg.USER_BASE = tempfile.mkdtemp()27 self.old_site = site.USER_SITE28 site.USER_SITE = develop_pkg.USER_SITE = tempfile.mkdtemp()29 def tearDown(self):30 os.chdir(self.old_cwd)31 shutil.rmtree(self.dir)32 if sys.version >= "2.6":33 shutil.rmtree(site.USER_BASE)34 shutil.rmtree(site.USER_SITE)35 site.USER_BASE = self.old_base36 site.USER_SITE = self.old_site37 def test_develop(self):38 if sys.version < "2.6":39 return40 dist = Distribution()41 dist.script_name = 'setup.py'42 cmd = develop(dist)43 cmd.user = 144 cmd.ensure_finalized()45 cmd.user = 146 old_stdout = sys.stdout47 sys.stdout = StringIO()48 try:49 cmd.run()50 finally:51 sys.stdout = old_stdout52 # let's see if we got our egg link at the right place53 content = os.listdir(site.USER_SITE)54 content.sort()...
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!!