Sha256: f42254036abfa139e5ce698122b9c556b20f5af17121db9d1ab18d99deb530fa

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

---
title: About the pip Resource
---

# pip

Use the `pip` InSpec audit resource to test packages that are installed using the Python PIP installer.

# Syntax

A `pip` resource block declares a package and (optionally) a package version:

    describe pip('Jinja2') do
      it { should be_installed }
    end

where

* `'Jinja2'` is the name of the package
* `be_installed` tests to see if the `Jinja2` package is installed


# Matchers

This InSpec audit resource has the following matchers:

## be

<%= partial "/shared/matcher_be" %>

## be_installed

The `be_installed` matcher tests if the named package is installed on the system:

    it { should be_installed }

## cmp

<%= partial "/shared/matcher_cmp" %>

## eq

<%= partial "/shared/matcher_eq" %>

## include

<%= partial "/shared/matcher_include" %>

## match

<%= partial "/shared/matcher_match" %>

## version

The `version` matcher tests if the named package version is on the system:

    its('version') { should eq '1.2.3' }

# Examples

The following examples show how to use this InSpec audit resource.

## Test if Jinja2 is installed on the system

    describe pip('Jinja2') do
      it { should be_installed }
    end

## Test if Jinja2 2.8 is installed on the system

    describe pip('Jinja2') do
      it { should be_installed }
      its('version') { should eq '2.8' }
    end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inspec-1.0.0 docs/resources/pip.md.erb
inspec-1.0.0.beta3 docs/resources/pip.md.erb