Skip to content

Instantly share code, notes, and snippets.

@vlasovskikh
Created September 7, 2012 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlasovskikh/c4205186445223b4a74f to your computer and use it in GitHub Desktop.
Save vlasovskikh/c4205186445223b4a74f to your computer and use it in GitHub Desktop.
Requirements parsing test
from unittest import TestCase
REQUIREMENTS_FILE = './requirements.txt'
REQUIRED_PACKAGE = 'Markdown'
class RequirementsTest(TestCase):
def test_parse_requirements(self):
import pkg_resources
with open(REQUIREMENTS_FILE, 'rb') as fd:
requirements = pkg_resources.parse_requirements(fd.read())
found = None
for requirement in requirements:
if requirement.key == REQUIRED_PACKAGE.lower():
found = requirement
self.assertIsNotNone(found)
def test_pip_installed(self):
import pip
self.assertIsNotNone(pip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment