From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QlNEA-0001MC-Dv for garchives@archives.gentoo.org; Mon, 25 Jul 2011 15:37:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7F2A121C0BB; Mon, 25 Jul 2011 15:37:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 24D0F21C0BB for ; Mon, 25 Jul 2011 15:37:46 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 727612AC017 for ; Mon, 25 Jul 2011 15:37:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 78D158003D for ; Mon, 25 Jul 2011 15:37:44 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <587ac83028d4ae851e4cc140687e03cbfeafc71c.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /, doc/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: doc/ebuild-test-case.md doc/library-format.md doc/pygments_style.css setup.py X-VCS-Directories: / doc/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 587ac83028d4ae851e4cc140687e03cbfeafc71c Date: Mon, 25 Jul 2011 15:37:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: d0e2c9e97938721ae2566443207bf124 commit: 587ac83028d4ae851e4cc140687e03cbfeafc71c Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Mon Jul 25 15:38:34 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Mon Jul 25 15:38:34 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D587ac830 Drop Markdown docs, API docs should be enough. --- doc/ebuild-test-case.md | 102 -----------------------------------------= ------ doc/library-format.md | 92 -----------------------------------------= - doc/pygments_style.css | 62 ---------------------------- setup.py | 78 ++---------------------------------- 4 files changed, 4 insertions(+), 330 deletions(-) diff --git a/doc/ebuild-test-case.md b/doc/ebuild-test-case.md deleted file mode 100644 index 4078cf1..0000000 --- a/doc/ebuild-test-case.md +++ /dev/null @@ -1,102 +0,0 @@ -EbuildTestCase -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -Quick description ------------------ - -`EbuildTestCase` is the most common test case implementation. It assumes -that a particular test case consists of a single ebuild which is suppose= d -to be run by PM. - -`EbuildTestCase` is declared in `pmstestsuite.library.case` module. - -By default, `EbuildTestCase` checks the result result by checking whethe= r it was -merged. - - -Using EbuildTestCase --------------------- - -An example use case would be like: - - from pmstestsuite.library.case import EbuildTestCase - - class RandomExampleTest(EbuildTestCase): - """ An absolutely random test. """ - - supported_eapis =3D (2, 3, 4) - relevant_eapis =3D (3, 4) - expect_failure =3D True - - ebuild_vars =3D { - 'HOMEPAGE': 'http://example.com/' - } - phase_funcs =3D { - 'src_compile': [ - 'echo 11', - 'die 12' - ] - } - -Where: - -- the class name is used to construct the test name (it would `random-ex= ample` - here), -- the docstring is used to form the ebuild `DESCRIPTION` (it can be over= rode - using `ebuild_vars['DESCRIPTION']`, -- `supported_eapis` (_iterable of strings_) specifies for which EAPIs th= e test - gives predictible (useful) results. It defaults to all supported EAPIs= , -- `relevant_eapis` (_iterable of strings_) specifies for which EAPIs the= test - will be performed by default (i.e. for which the results are expected - to change). It defaults to a random EAPI from `supported_eapis`, -- `expect_failure` (_bool_, default: _False_) specifies whether the ebui= ld is - supposed to fail merge, -- `ebuild_vars` (_dict of str -> str_) specifies additional global ebuil= d - variables to declare in the ebuild, -- `phase_funcs` (_dict of str -> iterable of strings_) specifies the con= tents of - ebuild phase functions. Each iterable element represents a single line= . - - -Extending EbuildTestCase ------------------------- - -If you'd like to create more complex test case, you'll probably need to = override -some methods of the `EbuildTestCase` class. It could look like: - - from pmstestsuite.library.case import EbuildTestCase - - class MoreComplexExampleTest(EbuildTestCase): - """ Now overriding methods! """ - - relevant_eapis =3D (0, 1, 2) - - phase_funcs =3D { - 'src_compile': [ - 'echo 11', - '[[ ${EAPI} -eq 2 ]] && die 12' - ] - } - - def __init__(self, eapi): - EbuildTestCase.__init__(self, eapi) - self.phase_funcs['src_install'].append('echo nah(%d)!' % eapi) - - def check_result(self, pm): - res =3D EbuildTestCase.check_result(self, pm) - return (res =3D=3D (self.eapi !=3D 2)) - -Overriding `__init__()` allows you to perform additional test modificati= ons when -it is instantiated for a particular EAPI. But remember to call superclas= s' -`__init__()` as well as it sets `self.eapi` and deepcopies all the stand= ard -variables (like `phase_funcs` and `ebuild_vars`). Without that, the phas= e func -change would be applied to a shared, class-defined variable! - -Overriding `check_result()` allows you to check the test results your ow= n way. -You can call superclass' `check_result()` to check whether the ebuild wa= s merged -into vdb (or the opposite, if `expect_failure` is _True_). - -Thus, the above example just adds a random, EAPI-dependant output into -`src_install()`, and expects the test to succeed if `eapi !=3D 2` and fa= il -otherwise. - - diff --git a/doc/library-format.md b/doc/library-format.md deleted file mode 100644 index 4ba6066..0000000 --- a/doc/library-format.md +++ /dev/null @@ -1,92 +0,0 @@ -PMS Test Suite -- test library format -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -Basic concepts --------------- - -The basic unit of a test suite is a _test case_. A test case forms a sin= gle -Python class. That class is then instantiated into one or more test case -instances. - -A _test case instance_ corresponds to a single actual test. Each instanc= e -provides functions to: - -1. merge any number of files to the test repository, -2. clean up the system before and after performing the tests, -3. merge the tests, -4. check the test results. - -A number of tests builds up a test library. Each _test library_ consists= of one -or more Python packages, providing a number of Python modules. Those mod= ules -shall contain at least the test case classes, and a single `TestLibrary` -subclass, providing a complete list of test cases. - - -The main library module ------------------------ - -Each library has to supply a _main library module_. Such a module has to= exist -in the `pmstestsuite.library` namespace. The module name (with that pref= ix -stripped) is considered the _test library name_ and is passed as the `-l= ` -argument. - -For example, `-l foobar` would correspond to a module called -`pmstestsuite.library.foobar`. - -The main library module has to declare a subclass of -`pmstestsuite.library.TestLibrary` class. The subclass has to override -the `test_names` property with a list of test class names with module pa= ths -relative to the main module. - -Example main module of a test library: - - from pmstestsuite.library import TestLibrary - - class FoobarTestLibrary(TestLibrary): - """ - Foo bar? - """ - - test_names=3D[ - 'foo.BarTest', - 'bar.FooTest' - ] - -The above example would load two tests: - -- `BarTest` from `pmstestsuite.library.foobar.foo`, -- and `FooTest` from `pmstestsuite.library.foobar.bar`. - - -The test class --------------- - -Each _test case_ has to be a subclass of `pmstestsuite.library.case.Test= Case`. -That class represents a most general test case with an interface describ= ed -above. A particular subclass needs to override the following methods: - -- `get_output_files()` returning a dict representing files which should = be - output to the test repository (keys being filenames relative - to the repository root and values being file contents), -- `clean()` removing any merged test data before and after performing th= e test, -- `start()` starting (scheduling) the actual test, -- `check_result()` checking the test results. It should return True if t= he test - succeeded and False otherwise. - -The three latter functions will be passed a `PackageManager` instance, w= hich -methods `merge()`, `unmerge()` and `installed` property can be used. For= more -information, please see the docs of `pmstestsuite.pm` module. - -In most cases, though, you won't be subclassing `TestCase` directly but = using -one of its subclasses defined in the `pmstestsuite.library` submodules. - - -More information ----------------- - -1. `pydoc pmstestsuite.library` -2. `pydoc pmstestsuite.library.case` -3. `pydoc pmstestsuite.pm.PackageManager` -4. `pydoc pmstestsuite.library.depend_case` - - diff --git a/doc/pygments_style.css b/doc/pygments_style.css deleted file mode 100644 index 145bc13..0000000 --- a/doc/pygments_style.css +++ /dev/null @@ -1,62 +0,0 @@ -.syntax .hll { background-color: #ffffcc } -.syntax { background: #f0f0f0; } -.syntax .c { color: #60a0b0; font-style: italic } /* Comment */ -.syntax .err { border: 1px solid #FF0000 } /* Error */ -.syntax .k { color: #007020; font-weight: bold } /* Keyword */ -.syntax .o { color: #666666 } /* Operator */ -.syntax .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline = */ -.syntax .cp { color: #007020 } /* Comment.Preproc */ -.syntax .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */ -.syntax .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Spe= cial */ -.syntax .gd { color: #A00000 } /* Generic.Deleted */ -.syntax .ge { font-style: italic } /* Generic.Emph */ -.syntax .gr { color: #FF0000 } /* Generic.Error */ -.syntax .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -.syntax .gi { color: #00A000 } /* Generic.Inserted */ -.syntax .go { color: #808080 } /* Generic.Output */ -.syntax .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ -.syntax .gs { font-weight: bold } /* Generic.Strong */ -.syntax .gu { color: #800080; font-weight: bold } /* Generic.Subheading = */ -.syntax .gt { color: #0040D0 } /* Generic.Traceback */ -.syntax .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ -.syntax .kd { color: #007020; font-weight: bold } /* Keyword.Declaration= */ -.syntax .kn { color: #007020; font-weight: bold } /* Keyword.Namespace *= / -.syntax .kp { color: #007020 } /* Keyword.Pseudo */ -.syntax .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ -.syntax .kt { color: #902000 } /* Keyword.Type */ -.syntax .m { color: #40a070 } /* Literal.Number */ -.syntax .s { color: #4070a0 } /* Literal.String */ -.syntax .na { color: #4070a0 } /* Name.Attribute */ -.syntax .nb { color: #007020 } /* Name.Builtin */ -.syntax .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ -.syntax .no { color: #60add5 } /* Name.Constant */ -.syntax .nd { color: #555555; font-weight: bold } /* Name.Decorator */ -.syntax .ni { color: #d55537; font-weight: bold } /* Name.Entity */ -.syntax .ne { color: #007020 } /* Name.Exception */ -.syntax .nf { color: #06287e } /* Name.Function */ -.syntax .nl { color: #002070; font-weight: bold } /* Name.Label */ -.syntax .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ -.syntax .nt { color: #062873; font-weight: bold } /* Name.Tag */ -.syntax .nv { color: #bb60d5 } /* Name.Variable */ -.syntax .ow { color: #007020; font-weight: bold } /* Operator.Word */ -.syntax .w { color: #bbbbbb } /* Text.Whitespace */ -.syntax .mf { color: #40a070 } /* Literal.Number.Float */ -.syntax .mh { color: #40a070 } /* Literal.Number.Hex */ -.syntax .mi { color: #40a070 } /* Literal.Number.Integer */ -.syntax .mo { color: #40a070 } /* Literal.Number.Oct */ -.syntax .sb { color: #4070a0 } /* Literal.String.Backtick */ -.syntax .sc { color: #4070a0 } /* Literal.String.Char */ -.syntax .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc= */ -.syntax .s2 { color: #4070a0 } /* Literal.String.Double */ -.syntax .se { color: #4070a0; font-weight: bold } /* Literal.String.Esca= pe */ -.syntax .sh { color: #4070a0 } /* Literal.String.Heredoc */ -.syntax .si { color: #70a0d0; font-style: italic } /* Literal.String.Int= erpol */ -.syntax .sx { color: #c65d09 } /* Literal.String.Other */ -.syntax .sr { color: #235388 } /* Literal.String.Regex */ -.syntax .s1 { color: #4070a0 } /* Literal.String.Single */ -.syntax .ss { color: #517918 } /* Literal.String.Symbol */ -.syntax .bp { color: #007020 } /* Name.Builtin.Pseudo */ -.syntax .vc { color: #bb60d5 } /* Name.Variable.Class */ -.syntax .vg { color: #bb60d5 } /* Name.Variable.Global */ -.syntax .vi { color: #bb60d5 } /* Name.Variable.Instance */ -.syntax .il { color: #40a070 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/setup.py b/setup.py index 3cea20c..097d124 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # (c) 2011 Micha=C5=82 G=C3=B3rny # Released under the terms of the 2-clause BSD license. =20 -from distutils.core import setup, Command, Distribution +from distutils.core import setup, Command =20 import os.path, subprocess, sys =20 @@ -18,77 +18,15 @@ class DocCommand(Command): user_options =3D [] =20 def initialize_options(self): - self.docs =3D self.distribution.docs - self.outfiles =3D [] + pass =20 def finalize_options(self): pass =20 def run(self): - try: - import markdown - except ImportError: - sys.stderr.write('Doc generation requires the markdown module:\nhttp:= //www.freewisdom.org/projects/python-markdown\n') - sys.exit(1) - - class PMSTSExts(markdown.Extension): - class TitleGrepper(markdown.treeprocessors.Treeprocessor): - def __init__(self, ska): - self._ska =3D ska - - def run(self, root): - for c in root: - if c.tag =3D=3D "h1": - self._ska.title =3D c.text - break - return root - - class HTMLSkelAdder(markdown.postprocessors.Postprocessor): - title =3D '' - - def run(self, text): - return ''' - - - - %s - - -''' % self.title + text + ''' - -''' - - class LangAdder(markdown.treeprocessors.Treeprocessor): - def run(self, root): - for c in root.getiterator('pre'): - children =3D c.getchildren() - if len(children) =3D=3D 1 and children[0].tag =3D=3D 'code': - children[0].text =3D ':::python\n' + children[0].text - - return root - - def extendMarkdown(self, md, md_globals): - ska =3D self.HTMLSkelAdder() - md.postprocessors.add('htmlskeladder', ska, '_end') - md.treeprocessors.add('titlegrepper', self.TitleGrepper(ska), '_end'= ) - md.treeprocessors.add('langadder', self.LangAdder(), '