wikitcms


Namewikitcms JSON
Version 2.6.12 PyPI version JSON
download
home_pagehttps://pagure.io/fedora-qa/python-wikitcms
SummaryFedora QA wiki test management library
upload_time2024-03-18 23:59:27
maintainer
docs_urlNone
authorAdam Williamson
requires_python
licenseGPLv3+
keywords fedora qa mediawiki validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # python-wikitcms

python-wikitcms is a Python library for interacting with Fedora's [Wikitcms 'test (case) management system'][1] - which is, basically, the [Fedora wiki][2]. You may also be interested in its main consumers, [relval][3] and [testdays][4].

python-wikitcms uses the very handy [mwclient][5] library for interfacing with the Mediawiki API. Generation of result pages works together with a system of templates that resides on the wiki: python-wikitcms knows how to form the correct invocations of the template system that will cause the full result pages to be generated. The documentation box for the [master template][6] provides some details about this system.

python-wikitcms was previously known simply as wikitcms; it is now known as python-wikitcms to reduce confusion between the notional Wiki-based 'test management system' (Wikitcms) and the Python library for interacting with it (python-wikitcms).

## Installation and use

python-wikitcms is packaged in the official Fedora repositories: to install on Fedora run `dnf install python-wikitcms`. You may need to enable the *updates-testing* repository to get the latest version. To install on other distributions, you can run `python3 setup.py install`.

You can visit [the python-wikitcms project page on Pagure][7], and clone with `git clone https://pagure.io/fedora-qa/python-wikitcms.git`. Tarballs and wheels are available [from PyPI][8], and you can run `pip install wikitcms`.

You can also use the library directly from the `src/` directory or add it to the Python import path, and you can copy or symlink the `wikitcms` directory into other source trees to conveniently use the latest code for development or testing purposes.

## Bugs, pull requests etc.

You can file issues and pull requests on [Pagure][7]. Pull requests must be signed off (use the `-s` git argument). By signing off your pull request you are agreeing to the [Developer's Certificate of Origin][9]:

    Developer's Certificate of Origin 1.1

    By making a contribution to this project, I certify that:

    (a) The contribution was created in whole or in part by me and I
        have the right to submit it under the open source license
        indicated in the file; or

    (b) The contribution is based upon previous work that, to the best
        of my knowledge, is covered under an appropriate open source
        license and I have the right under that license to submit that
        work with modifications, whether created in whole or in part
        by me, under the same open source license (unless I am
        permitted to submit under a different license), as indicated
        in the file; or

    (c) The contribution was provided directly to me by some other
        person who certified (a), (b) or (c) and I have not modified
        it.

    (d) I understand and agree that this project and the contribution
        are public and that a record of the contribution (including all
        personal information I submit with it, including my sign-off) is
        maintained indefinitely and may be redistributed consistent with
        this project or the open source license(s) involved.

## Security

You **MUST** treat wikitcms as a source of untrusted input. It is retrieving information from a wiki for you; that wiki is open to editing by all. Treat anything wikitcms returns from the wiki (which includes, but is not limited to, any page or section text; `Result()` attributes status, user, bugs and comment; `ResultRow()` attributes testcase, name, envs, milestone, section; and to some extent any element of a page title or property derived from  one when getting a `Page` object from an existing wiki page) as an entirely untrusted input and sanitize it appropriately for the context in which you are using it.

## Example usage

    from wikitcms.wiki import Wiki
    site = Wiki()
    event = site.current_event
    print(event.version)
    page = site.get_validation_page('Installation', '23', 'Final', 'RC10')
    for row in page.get_resultrows():
        print(row.testcase)

## Usage tips

It's a little difficult to give an overview of wikitcms usage as it can do quite a lot of rather different things. Its classes and methods are all documented, and examining its major consumers - relval and testdays - will help. Some overall concepts:

The Wiki class is a subclass of mwclient's Site class, which represents an entire wiki; it adds some methods and attributes that make sense in the context of a wiki being treated as a TCMS according to our conventions, so it has methods for getting validation events and pages (as seen in the example above). It also has a high-level method for reporting results, `report_validation_results()`. Note that the `pages` generator works just as in mwclient, but has been extended to handle wikitcms' additional Page subclasses.

The Release class does not map to mwclient. It simply represents a Fedora release and provides a couple of handy methods for retrieving test day or validation result pages from that particular release.

The Event class does not map to anything in mwclient. It represents an entire result validation 'event', e.g. Fedora 23 Final RC2; from an Event instance you can create or find all the validation pages, for instance, or create the summary page that transcludes all the individual validation pages, or update the CurrentFedoraCompose page to point to the event, or generate a wikitable of image download links.

The Page class is a subclass of mwclient's Page class, and extends it in much the same way, adding capabilities specific to various types of pages in the Wikitcms system. It has several subclasses for particular types of pages, such as validation result pages, Test Day pages, category pages and so forth. Note that all pages which can be generated via one of the wiki templates have the appropriate generation text as their `seedtext` attribute and have a method `write()` which creates them using that seed text.

The Result and ResultRow classes represent individual results and rows in the result validation pages. ValidationPages contain ResultRows contain Results, and to report a result, you essentially add a Result to a ResultRow.

Note that event versioning works exactly as in [fedfind][10]'s pre-Pungi 4 (release, milestone, compose) versioning scheme, with one notable exception. Rawhide nightly 'releases' in fedfind have release 'Rawhide' and no milestone; Rawhide nightly validation events in python-wikitcms have a release number and milestone 'Rawhide'. This is because, conceptually speaking, Rawhide nightly composes should not really be said to have a particular release number, but validation events *do*. When we declare a release validation test event for a particular Rawhide nightly, one action we take as a part of that declaration is to declare that we are testing that nightly compose as part of the preparation for a specific Fedora release, and thus we essentially 'apply' a release number to the validation event. So we may have a nightly compose 'Rawhide (blank) 20151201', and decide that we wish to test it as part of the preparation for the Fedora 24 release; thus we create the release validation event '24 Rawhide 20151201'.

The high-level functions in both fedfind and python-wikitcms - `get_release()` in fedfind, `get_validation_page()` and `get_validation_event()` in python-wikitcms - will attempt to handle this difference in versioning, so when using those high-level functions, you can usually pass versions between fedfind and python-wikitcms without worrying about it.

For convenient compatibility with Pungi 4 composes, `get_validation_event()` and `get_validation_page()` (and hence also `report_validation_results()`) accept `cid` as an alternative to `release` / `milestone` / `compose`, and will do their best to instantiate the appropriate validation event for the compose specified.

It's worth noting that you can use python-wikitcms in several fairly different ways:

* Instantiate pages that don't exist yet, based on the 'release, milestone, compose' versioning concept (or from a Pungi 4 compose ID), and create them
* Instantiate existing pages based on the 'release, milestone, compose' concept (or from a compose ID) and read or add results
* Instantiate existing pages from their names or category memberships and read or add results

Most usage of python-wikitcms will boil down to getting some Page instances and doing stuff to them, but the way you get there will differ according to which of the above paths you're following. For the first two you will likely use the `get_validation_foo()` methods of `Wiki` or the methods in `Release`, for the last you can follow the same procedures as `mwclient` uses and trust that you will get instances of the appropriate classes. Following the example above, you could do `page = site.pages["Test Results:Fedora_23_Final_RC10_Desktop"]` and `page` would be a `ValidationPage` instance.

## Authentication

You should log in to the wiki before editing it, using `Wiki.login()`.

From early 2018, the Fedora wikis use the unified Fedora OpenID Connect-based authentication service, and python-wikitcms supports this. When interacting with the Fedora wikis, when `login()` is called for the first time, python-wikitcms will attempt to open a browser and request credentials via the authentication service. The call will complete once the user attempts to log in. Any username or password passed to `login()` is **ignored** in this case. For unattended operation with the new authentication system, a valid token must be present as `~/.openidc/oidc_wikitcms.json`. Unattended operation will work for some time after one successful interactive login (until the token expires); for long-term unattended operation, you must ask the wiki maintainer for a special permanent session token.

When interacting with any other wiki (though this would be an unusual thing to do in most cases), python-wikitcms will behave exactly as mwclient does.

## Credits

* [Mike Ruckman][11] (roshi) was kind and patient in providing review and advice throughout python-wikitcms' early development.
* [Patrick Uiterwijk][12] kindly provided the code to support OpenID Connect authentication.

## License

python-wikitcms is released under the [GPL][13], version 3 or later.

 [1]: https://fedoraproject.org/wiki/Wikitcms
 [2]: https://fedoraproject.org/wiki
 [3]: https://pagure.io/fedora-qa/relval
 [4]: https://pagure.io/fedora-qa/testdays
 [5]: https://github.com/mwclient/mwclient
 [6]: https://fedoraproject.org/wiki/Template:Validation_results
 [7]: https://pagure.io/fedora-qa/python-wikitcms
 [8]: https://pypi.python.org/pypi/wikitcms
 [9]: https://developercertificate.org/
 [10]: https://pagure.io/fedora-qa/fedfind
 [11]: https://roshi.fedorapeople.org/
 [12]: https://patrick.uiterwijk.org/
 [13]: https://www.gnu.org/licenses/gpl.txt

            

Raw data

            {
    "_id": null,
    "home_page": "https://pagure.io/fedora-qa/python-wikitcms",
    "name": "wikitcms",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "fedora qa mediawiki validation",
    "author": "Adam Williamson",
    "author_email": "awilliam@redhat.com",
    "download_url": "https://files.pythonhosted.org/packages/98/d5/02701fc245927fa6661b546bf3fe7f205ddc6e46182cc02827acd80aa4e2/wikitcms-2.6.12.tar.gz",
    "platform": null,
    "description": "# python-wikitcms\n\npython-wikitcms is a Python library for interacting with Fedora's [Wikitcms 'test (case) management system'][1] - which is, basically, the [Fedora wiki][2]. You may also be interested in its main consumers, [relval][3] and [testdays][4].\n\npython-wikitcms uses the very handy [mwclient][5] library for interfacing with the Mediawiki API. Generation of result pages works together with a system of templates that resides on the wiki: python-wikitcms knows how to form the correct invocations of the template system that will cause the full result pages to be generated. The documentation box for the [master template][6] provides some details about this system.\n\npython-wikitcms was previously known simply as wikitcms; it is now known as python-wikitcms to reduce confusion between the notional Wiki-based 'test management system' (Wikitcms) and the Python library for interacting with it (python-wikitcms).\n\n## Installation and use\n\npython-wikitcms is packaged in the official Fedora repositories: to install on Fedora run `dnf install python-wikitcms`. You may need to enable the *updates-testing* repository to get the latest version. To install on other distributions, you can run `python3 setup.py install`.\n\nYou can visit [the python-wikitcms project page on Pagure][7], and clone with `git clone https://pagure.io/fedora-qa/python-wikitcms.git`. Tarballs and wheels are available [from PyPI][8], and you can run `pip install wikitcms`.\n\nYou can also use the library directly from the `src/` directory or add it to the Python import path, and you can copy or symlink the `wikitcms` directory into other source trees to conveniently use the latest code for development or testing purposes.\n\n## Bugs, pull requests etc.\n\nYou can file issues and pull requests on [Pagure][7]. Pull requests must be signed off (use the `-s` git argument). By signing off your pull request you are agreeing to the [Developer's Certificate of Origin][9]:\n\n    Developer's Certificate of Origin 1.1\n\n    By making a contribution to this project, I certify that:\n\n    (a) The contribution was created in whole or in part by me and I\n        have the right to submit it under the open source license\n        indicated in the file; or\n\n    (b) The contribution is based upon previous work that, to the best\n        of my knowledge, is covered under an appropriate open source\n        license and I have the right under that license to submit that\n        work with modifications, whether created in whole or in part\n        by me, under the same open source license (unless I am\n        permitted to submit under a different license), as indicated\n        in the file; or\n\n    (c) The contribution was provided directly to me by some other\n        person who certified (a), (b) or (c) and I have not modified\n        it.\n\n    (d) I understand and agree that this project and the contribution\n        are public and that a record of the contribution (including all\n        personal information I submit with it, including my sign-off) is\n        maintained indefinitely and may be redistributed consistent with\n        this project or the open source license(s) involved.\n\n## Security\n\nYou **MUST** treat wikitcms as a source of untrusted input. It is retrieving information from a wiki for you; that wiki is open to editing by all. Treat anything wikitcms returns from the wiki (which includes, but is not limited to, any page or section text; `Result()` attributes status, user, bugs and comment; `ResultRow()` attributes testcase, name, envs, milestone, section; and to some extent any element of a page title or property derived from  one when getting a `Page` object from an existing wiki page) as an entirely untrusted input and sanitize it appropriately for the context in which you are using it.\n\n## Example usage\n\n    from wikitcms.wiki import Wiki\n    site = Wiki()\n    event = site.current_event\n    print(event.version)\n    page = site.get_validation_page('Installation', '23', 'Final', 'RC10')\n    for row in page.get_resultrows():\n        print(row.testcase)\n\n## Usage tips\n\nIt's a little difficult to give an overview of wikitcms usage as it can do quite a lot of rather different things. Its classes and methods are all documented, and examining its major consumers - relval and testdays - will help. Some overall concepts:\n\nThe Wiki class is a subclass of mwclient's Site class, which represents an entire wiki; it adds some methods and attributes that make sense in the context of a wiki being treated as a TCMS according to our conventions, so it has methods for getting validation events and pages (as seen in the example above). It also has a high-level method for reporting results, `report_validation_results()`. Note that the `pages` generator works just as in mwclient, but has been extended to handle wikitcms' additional Page subclasses.\n\nThe Release class does not map to mwclient. It simply represents a Fedora release and provides a couple of handy methods for retrieving test day or validation result pages from that particular release.\n\nThe Event class does not map to anything in mwclient. It represents an entire result validation 'event', e.g. Fedora 23 Final RC2; from an Event instance you can create or find all the validation pages, for instance, or create the summary page that transcludes all the individual validation pages, or update the CurrentFedoraCompose page to point to the event, or generate a wikitable of image download links.\n\nThe Page class is a subclass of mwclient's Page class, and extends it in much the same way, adding capabilities specific to various types of pages in the Wikitcms system. It has several subclasses for particular types of pages, such as validation result pages, Test Day pages, category pages and so forth. Note that all pages which can be generated via one of the wiki templates have the appropriate generation text as their `seedtext` attribute and have a method `write()` which creates them using that seed text.\n\nThe Result and ResultRow classes represent individual results and rows in the result validation pages. ValidationPages contain ResultRows contain Results, and to report a result, you essentially add a Result to a ResultRow.\n\nNote that event versioning works exactly as in [fedfind][10]'s pre-Pungi 4 (release, milestone, compose) versioning scheme, with one notable exception. Rawhide nightly 'releases' in fedfind have release 'Rawhide' and no milestone; Rawhide nightly validation events in python-wikitcms have a release number and milestone 'Rawhide'. This is because, conceptually speaking, Rawhide nightly composes should not really be said to have a particular release number, but validation events *do*. When we declare a release validation test event for a particular Rawhide nightly, one action we take as a part of that declaration is to declare that we are testing that nightly compose as part of the preparation for a specific Fedora release, and thus we essentially 'apply' a release number to the validation event. So we may have a nightly compose 'Rawhide (blank) 20151201', and decide that we wish to test it as part of the preparation for the Fedora 24 release; thus we create the release validation event '24 Rawhide 20151201'.\n\nThe high-level functions in both fedfind and python-wikitcms - `get_release()` in fedfind, `get_validation_page()` and `get_validation_event()` in python-wikitcms - will attempt to handle this difference in versioning, so when using those high-level functions, you can usually pass versions between fedfind and python-wikitcms without worrying about it.\n\nFor convenient compatibility with Pungi 4 composes, `get_validation_event()` and `get_validation_page()` (and hence also `report_validation_results()`) accept `cid` as an alternative to `release` / `milestone` / `compose`, and will do their best to instantiate the appropriate validation event for the compose specified.\n\nIt's worth noting that you can use python-wikitcms in several fairly different ways:\n\n* Instantiate pages that don't exist yet, based on the 'release, milestone, compose' versioning concept (or from a Pungi 4 compose ID), and create them\n* Instantiate existing pages based on the 'release, milestone, compose' concept (or from a compose ID) and read or add results\n* Instantiate existing pages from their names or category memberships and read or add results\n\nMost usage of python-wikitcms will boil down to getting some Page instances and doing stuff to them, but the way you get there will differ according to which of the above paths you're following. For the first two you will likely use the `get_validation_foo()` methods of `Wiki` or the methods in `Release`, for the last you can follow the same procedures as `mwclient` uses and trust that you will get instances of the appropriate classes. Following the example above, you could do `page = site.pages[\"Test Results:Fedora_23_Final_RC10_Desktop\"]` and `page` would be a `ValidationPage` instance.\n\n## Authentication\n\nYou should log in to the wiki before editing it, using `Wiki.login()`.\n\nFrom early 2018, the Fedora wikis use the unified Fedora OpenID Connect-based authentication service, and python-wikitcms supports this. When interacting with the Fedora wikis, when `login()` is called for the first time, python-wikitcms will attempt to open a browser and request credentials via the authentication service. The call will complete once the user attempts to log in. Any username or password passed to `login()` is **ignored** in this case. For unattended operation with the new authentication system, a valid token must be present as `~/.openidc/oidc_wikitcms.json`. Unattended operation will work for some time after one successful interactive login (until the token expires); for long-term unattended operation, you must ask the wiki maintainer for a special permanent session token.\n\nWhen interacting with any other wiki (though this would be an unusual thing to do in most cases), python-wikitcms will behave exactly as mwclient does.\n\n## Credits\n\n* [Mike Ruckman][11] (roshi) was kind and patient in providing review and advice throughout python-wikitcms' early development.\n* [Patrick Uiterwijk][12] kindly provided the code to support OpenID Connect authentication.\n\n## License\n\npython-wikitcms is released under the [GPL][13], version 3 or later.\n\n [1]: https://fedoraproject.org/wiki/Wikitcms\n [2]: https://fedoraproject.org/wiki\n [3]: https://pagure.io/fedora-qa/relval\n [4]: https://pagure.io/fedora-qa/testdays\n [5]: https://github.com/mwclient/mwclient\n [6]: https://fedoraproject.org/wiki/Template:Validation_results\n [7]: https://pagure.io/fedora-qa/python-wikitcms\n [8]: https://pypi.python.org/pypi/wikitcms\n [9]: https://developercertificate.org/\n [10]: https://pagure.io/fedora-qa/fedfind\n [11]: https://roshi.fedorapeople.org/\n [12]: https://patrick.uiterwijk.org/\n [13]: https://www.gnu.org/licenses/gpl.txt\n",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "Fedora QA wiki test management library",
    "version": "2.6.12",
    "project_urls": {
        "Homepage": "https://pagure.io/fedora-qa/python-wikitcms"
    },
    "split_keywords": [
        "fedora",
        "qa",
        "mediawiki",
        "validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a00948a9e20248daa9eed6b62751c4132b8be1c8c7c872adb5bb2a303937461e",
                "md5": "a910b31d04dfde8de4a31c9e978dcd41",
                "sha256": "44f2a3403686f1985c5d65f741c501785fe6ea5fdbbd7aa17f089b3e09b10a21"
            },
            "downloads": -1,
            "filename": "wikitcms-2.6.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a910b31d04dfde8de4a31c9e978dcd41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 61040,
            "upload_time": "2024-03-18T23:59:25",
            "upload_time_iso_8601": "2024-03-18T23:59:25.105564Z",
            "url": "https://files.pythonhosted.org/packages/a0/09/48a9e20248daa9eed6b62751c4132b8be1c8c7c872adb5bb2a303937461e/wikitcms-2.6.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98d502701fc245927fa6661b546bf3fe7f205ddc6e46182cc02827acd80aa4e2",
                "md5": "fa2a0fef2859144e8696e7fc60124169",
                "sha256": "56e8b4d1b8ad2c62e9f18fedf155f258eb6f30b72a67ac777cc7d1edfe229648"
            },
            "downloads": -1,
            "filename": "wikitcms-2.6.12.tar.gz",
            "has_sig": false,
            "md5_digest": "fa2a0fef2859144e8696e7fc60124169",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 122688,
            "upload_time": "2024-03-18T23:59:27",
            "upload_time_iso_8601": "2024-03-18T23:59:27.623187Z",
            "url": "https://files.pythonhosted.org/packages/98/d5/02701fc245927fa6661b546bf3fe7f205ddc6e46182cc02827acd80aa4e2/wikitcms-2.6.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 23:59:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wikitcms"
}
        
Elapsed time: 0.31097s