# HG changeset patch # User Jeff Hammel # Date 1456181552 28800 # Node ID 33af6dac25de1a69a35ff61b1b72fdfc7e703c7c # Parent 39090ffe58f0b93e2bbfcfa531be48898f878e94 remove tests; theyre all based on old things that dont work, sadly diff -r 39090ffe58f0 -r 33af6dac25de tests/doctest.txt --- a/tests/doctest.txt Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -Test PaInt -========== - -The obligatory imports:: - - >>> import os - >>> import paint - -Get the dependencies of a package:: - - >>> jetperf = paint.Package('http://k0s.org/mozilla/hg/jetperf/archive/tip.tar.gz', verbose=False) - >>> dependencies = jetperf.dependencies() - >>> dependencies == {'mozharness': 'http://hg.mozilla.org/build/mozharness/archive/tip.tar.gz#egg=mozharness', 'talos': 'http://hg.mozilla.org/build/talos/archive/tip.tar.gz#egg=talos'} - True - >>> jetperf._cleanup() - -Test different ways of getting package information. First we'll use -an interface that overrides ``setuptools.setup``:: - - >>> import paint.info - >>> dummy_path = os.path.join(here, 'dummy') - >>> package_info = paint.info.SetupOverridePackageInfo(dummy_path) - >>> info = package_info() - >>> info['name'] - 'dummy' - -Now let's use the .egg-info way:: - - >>> package_info = paint.info.EggInfo(dummy_path) - >>> info = package_info() diff -r 39090ffe58f0 -r 33af6dac25de tests/dummy/README.txt --- a/tests/dummy/README.txt Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -dummy -=========== - -a dummy package - ----- - -Jeff Hammel - -http://example.com/ - diff -r 39090ffe58f0 -r 33af6dac25de tests/dummy/dummy/__init__.py --- a/tests/dummy/dummy/__init__.py Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# dummy file - diff -r 39090ffe58f0 -r 33af6dac25de tests/dummy/setup.py --- a/tests/dummy/setup.py Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -""" -setup packaging script for dummy -""" - -import os - -version = "0.1" -dependencies = [] - -kw = {} - -from setuptools import setup -kw['entry_points'] = """ -""" -kw['install_requires'] = dependencies - -try: - here = os.path.dirname(os.path.abspath(__file__)) - description = file(os.path.join(here, 'README.txt')).read() -except IOError: - description = '' - -setup(name='dummy', - version=version, - description="a dummy package", - long_description=description, - classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers - author='Jeff Hammel', - author_email='jhammel@mozilla.com', - url='http://example.com/', - license='', - packages=['dummy'], - include_package_data=True, - zip_safe=False, - **kw - ) diff -r 39090ffe58f0 -r 33af6dac25de tests/sanity.txt --- a/tests/sanity.txt Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -Sanity Check -============ - -Imports:: - - >>> import pkginfo - >>> from distutils.dist import Distribution - >>> from StringIO import StringIO - -Representative metadata:: - - >>> attrs = dict(name='name', version='0.0', description='description', url='http://example.org') - -Make a distribution:: - - >>> distribution = Distribution(attrs) - >>> buffer = StringIO() - >>> distribution.metadata.write_pkg_file(buffer) - >>> pkginfo_dist = pkginfo.Distribution() - >>> pkginfo_dist.parse(buffer.getvalue()) - >>> newattrs = dict([(i, getattr(pkginfo_dist, i)) for i in pkginfo_dist]) - >>> newattrs['name'] == 'name' - True - >>> newattrs['home_page'] == 'http://example.org' - True - -Convert to headers:: - - >>> header_dict = dict((attr_name, header_name) for header_name, attr_name, multiple in pkginfo_dist._getHeaderAttrs()) - >>> info = dict((header_dict[key], value) for key, value in newattrs.items()) - >>> sorted(info.keys()) - ['Author', 'Author-email', 'Description', 'Home-Page', 'Keywords', 'License', 'Metadata-Version', 'Name', 'Platform', 'Summary', 'Supported-Platform', 'Version'] - >>> info['Name'] == 'name' - True - >>> info['Home-Page'] == 'http://example.org' # it should actually be Home-page: http://svn.python.org/projects/peps/trunk/pep-0314.txt, bug in pkginfo - True diff -r 39090ffe58f0 -r 33af6dac25de tests/test.py --- a/tests/test.py Sat Sep 21 19:37:04 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -""" -doctest runner -""" - -import doctest -import os -import sys -from optparse import OptionParser - - -def run_tests(raise_on_error=False, report_first=False): - - # add results here - results = {} - - # doctest arguments - directory = os.path.dirname(os.path.abspath(__file__)) - extraglobs = {'here': directory} - doctest_args = dict(extraglobs=extraglobs, raise_on_error=raise_on_error) - if report_first: - doctest_args['optionflags'] = doctest.REPORT_ONLY_FIRST_FAILURE - - # gather tests - tests = [ test for test in os.listdir(directory) - if test.endswith('.txt') ] - - # run the tests - for test in tests: - try: - results[test] = doctest.testfile(test, **doctest_args) - except doctest.DocTestFailure, failure: - raise - except doctest.UnexpectedException, failure: - raise failure.exc_info[0], failure.exc_info[1], failure.exc_info[2] - - return results - -def main(args=sys.argv[1:]): - - # parse command line args - parser = OptionParser(description=__doc__) - parser.add_option('--raise', dest='raise_on_error', - default=False, action='store_true', - help="raise on first error") - parser.add_option('--report-first', dest='report_first', - default=False, action='store_true', - help="report the first error only (all tests will still run)") - options, args = parser.parse_args(args) - - # run the tests - results = run_tests(**options.__dict__) - if sum([i.failed for i in results.values()]): - sys.exit(1) # error - - -if __name__ == '__main__': - main() -