Created
May 21, 2009 22:21
-
-
Save srid/115787 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# an example of ordered test runs using yield | |
def test_typical_usecase(): | |
"""Test the typical use case, which is to - | |
1) update 2) search 3) install 4) remove | |
.. and 5) import | |
""" | |
c, repo_root_url = prepare_client(packages_small_list) | |
c.do_update(None, None, repo_root_url) | |
def test_search(): | |
for pkg in packages: | |
sample_keyword = pkg['name'][:3] | |
logger.info('Searching for `%s` expecting `%s`', sample_keyword, pkg['name']) | |
results = [p.name for p in c.do_search(None, None, sample_keyword)] | |
logger.info('Got results: %s', results) | |
assert pkg['name'] in results | |
def test_list_all(all_status): | |
opts.all = True | |
for ipkg in c.do_list(None, opts): | |
assert ipkg.status == all_status | |
assert ipkg.pkg.name in [p['name'] for p in packages] | |
def test_install(): | |
for pkg in packages: | |
c.do_install(None, opts, pkg['name']) | |
shownpkg = c.do_show(None, None, pkg['name']) | |
assert shownpkg.name == pkg['name'] | |
def test_import(): | |
for pkg in packages: | |
c.pypmenv.pyenv.eval( | |
'', | |
pkg['imports'], | |
) | |
def test_list(): | |
opts.all = False | |
for ipkg in c.do_list(None, opts): | |
assert ipkg.pkg.name in [p['name'] for p in packages] | |
def test_remove(): | |
for pkg in packages: | |
c.do_remove(None, None, pkg['name']) | |
yield 'search', test_search | |
yield ('list_all before install', | |
test_list_all, | |
inspect.Inspector.InspectedPackage.NOTINSTALLED) | |
yield 'install', test_install | |
yield ('list_all after install', | |
test_list_all, | |
inspect.Inspector.InspectedPackage.INSTALLED) | |
yield 'test_list', test_list | |
yield 'import', test_import | |
yield 'remove', test_remove |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment