The test fixture has a run method which allows you to run commands ![]() install_package ( 'my_package', build_egg = True ) Running Commands Is an option to build and install an egg as well: def test_installing_source ( virtualenv ): # Install a source checkout of my_package as an egg file virtualenv. Installed into the virtualenv using python setup.py develop, there Python setup.py develop will be detected as such and can be Same runtime that py.test is installed in) as source checkouts using assert 'coverage' in Developing Source CheckoutsĪny packages set up in the test runner’s python environment (ie, the install_package ( 'coverage', installer = 'pip' ) # installed_packages() will return a list of `PackageEntry` objects. def test_installing ( virtualenv ): virtualenv. You can install packages by name and query what’s installed. endswith ( '/bin/python' ) Installing Packages ![]() intersection ( set ( dirnames )) # the 'python' attribute is a `path.py` object for the python executable assert virtualenv. Here’s a noddy test case to demonstrate the basic fixture attributes.įor more information on path.py see def test_virtualenv ( virtualenv ): # the 'virtualenv' attribute is a `path.py` object for the root of the virtualenv dirnames = virtualenv. Which virtualenv executable will be used to create new venvs ![]() This fixture is configured using the following evironment variables When using setuptools entry points): pytest_plugins = Configuration Install using your favourite package installer: pip install pytest-virtualenvĮnable the fixture explicitly in your tests or conftest.py (not required The fixture has utility methods to install packages and list Create a Python virtual environment in your test that cleans up on
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |