issue-watcher


Nameissue-watcher JSON
Version 5.0.0 PyPI version JSON
download
home_pagehttps://github.com/radeklat/issue-watcher
SummaryPython test cases watching when an issue is closed and failing a test to let you know fixed functionality is available.
upload_time2022-12-30 10:00:37
maintainer
docs_urlNone
authorRadek Lát
requires_python>=3.7.2,<=3.11
licenseMIT
keywords pytest github issues testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # issue-watcher
Sometimes it happens that you discover a bug in a library that you are using and have to create a workaround (technical debt). However, it would be good to also remove the workaround once a bugfix is released.

This library provides several useful assertions that are watching when an issue is closed and failing a test to let you know fixed functionality is available. A good way to automatically manage and reduce known technical debt.

![PyPI - Downloads](https://img.shields.io/pypi/dm/issue-watcher)
![CircleCI](https://img.shields.io/circleci/build/github/radeklat/issue-watcher)
![Codecov](https://img.shields.io/codecov/c/github/radeklat/issue-watcher)
![PyPI - License](https://img.shields.io/pypi/l/issue-watcher)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/issue-watcher)
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/radeklat/issue-watcher)
![Maintenance](https://img.shields.io/maintenance/yes/2022)
![GitHub last commit](https://img.shields.io/github/last-commit/radeklat/issue-watcher)

# Installation

    pip install issue-watcher
    
# Support

## Issue trackers

* GitHub
    
# Usage

Let's assume you want to watch a [Safety](https://github.com/pyupio/safety) [issue #119](https://github.com/pyupio/safety/issues/119) preventing you from running the tool on Windows. Once fixed, you would like to enable it on Windows.

Following examples will show typical steps you would take and automation available from this package.

## Issue is open

You would like to be notified once the issue is resolved (closed) and enable the currently disabled behaviour. To get notified in relevant place, create the following test case:

    from unittest import TestCase
    
    from issuewatcher import AssertGitHubIssue
    
    class BugsInSafetyAreFixedTestCase(TestCase):
        def test_safety_cannot_be_enable_on_windows(self):
            AssertGitHubIssue("pyupio/safety").is_open(
                119, "Check if safety can be enabled on Windows."
            )
            
Alternatively, with pytest:

    from issuewatcher import AssertGitHubIssue
    
    def test_safety_cannot_be_enable_on_windows(self):
        AssertGitHubIssue("pyupio/safety").is_open(
            119, "Check if safety can be enabled on Windows."
        )
        
Once the issue is closed on GitHub, the test will fail with the following error message:

    GitHub issue #119 from 'pyupio/safety' is no longer open. Check if safety 
    can be enabled on Windows. Visit https://github.com/pyupio/safety/issues/119.
    
## Issues is closed ...

You can update the test case to watch if issue is not re-opened. Change the test case from:

    def test_safety_cannot_be_enable_on_windows(self):
        AssertGitHubIssue("pyupio/safety").is_open(
            119, "Check if safety can be enabled on Windows."
        )
        
to

    def test_safety_can_be_enable_on_windows(self):
        AssertGitHubIssue("pyupio/safety").is_closed(
            119, "Check if safety should be disabled on Windows."
        )

The updated test case will now fail if issue gets re-opened.

## ... but fix is not released yet

To watch for the fix to be released, you can add a release watch test.

### I don't know which version will contain the fix

Assuming that there are 25 releases at the moment of writing the test:

    def test_safety_fix_has_not_been_released(self):
        AssertGitHubIssue("pyupio/safety").current_release(25)
        
If you're not sure how many releases there are at the moment, you can leave the release number empty:

    def test_safety_fix_has_not_been_released(self):
        AssertGitHubIssue("pyupio/safety").current_release()
        
and the test will report it in the failing test:

    This test does not have any number of releases set. Current number of releases is '25'.

### I know the version of a release that will contain the fix

Sometimes the maintainer will mention which release will include the fix. Let's assume the release will be `2.0.0`. To get notified about it, use:

    def test_safety_fix_has_not_been_released(self):
        AssertGitHubIssue("pyupio/safety").fixed_in("2.0.0")
        
## Fix is released
        
Once a new release is available, the test above will fail with:

    New release of 'pyupio/safety' is available. Expected 25 releases but 26 are
    now available. Visit https://github.com/pyupio/safety/releases.

or

    Release '2.0.0' of 'pyupio/safety' is available. Latest version is
    '2.2.4'. Visit https://github.com/pyupio/safety/releases.
    
Now you can remove the tech debt and the release test case. However, keep the issue status test case to check for a regression.

# Environment variables

`GITHUB_USER_NAME`, `GITHUB_PERSONAL_ACCESS_TOKEN`: Set to GitHub user name and [personal access token](https://github.com/settings/tokens) to raise API limit from 60 requests/hour for a host to 5000 requests/hour on that API key.

`CACHE_INVALIDATION_IN_SECONDS`: Set to number of seconds for invalidating cached data retrieved from HTTP calls. Default value is `3600` seconds (1 day). Use `0` to disable caching. This is useful if you run tests frequently to speed them up and prevent API quota depletion.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/radeklat/issue-watcher",
    "name": "issue-watcher",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.2,<=3.11",
    "maintainer_email": "",
    "keywords": "pytest,github,issues,testing",
    "author": "Radek L\u00e1t",
    "author_email": "radek.lat@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2f/d2/89982c18fb5f151085adf2627100d56436ca7ca22bf60c1d6ef90a239a4a/issue_watcher-5.0.0.tar.gz",
    "platform": null,
    "description": "# issue-watcher\nSometimes it happens that you discover a bug in a library that you are using and have to create a workaround (technical debt). However, it would be good to also remove the workaround once a bugfix is released.\n\nThis library provides several useful assertions that are watching when an issue is closed and failing a test to let you know fixed functionality is available. A good way to automatically manage and reduce known technical debt.\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/issue-watcher)\n![CircleCI](https://img.shields.io/circleci/build/github/radeklat/issue-watcher)\n![Codecov](https://img.shields.io/codecov/c/github/radeklat/issue-watcher)\n![PyPI - License](https://img.shields.io/pypi/l/issue-watcher)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/issue-watcher)\n![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/radeklat/issue-watcher)\n![Maintenance](https://img.shields.io/maintenance/yes/2022)\n![GitHub last commit](https://img.shields.io/github/last-commit/radeklat/issue-watcher)\n\n# Installation\n\n    pip install issue-watcher\n    \n# Support\n\n## Issue trackers\n\n* GitHub\n    \n# Usage\n\nLet's assume you want to watch a [Safety](https://github.com/pyupio/safety) [issue #119](https://github.com/pyupio/safety/issues/119) preventing you from running the tool on Windows. Once fixed, you would like to enable it on Windows.\n\nFollowing examples will show typical steps you would take and automation available from this package.\n\n## Issue is open\n\nYou would like to be notified once the issue is resolved (closed) and enable the currently disabled behaviour. To get notified in relevant place, create the following test case:\n\n    from unittest import TestCase\n    \n    from issuewatcher import AssertGitHubIssue\n    \n    class BugsInSafetyAreFixedTestCase(TestCase):\n        def test_safety_cannot_be_enable_on_windows(self):\n            AssertGitHubIssue(\"pyupio/safety\").is_open(\n                119, \"Check if safety can be enabled on Windows.\"\n            )\n            \nAlternatively, with pytest:\n\n    from issuewatcher import AssertGitHubIssue\n    \n    def test_safety_cannot_be_enable_on_windows(self):\n        AssertGitHubIssue(\"pyupio/safety\").is_open(\n            119, \"Check if safety can be enabled on Windows.\"\n        )\n        \nOnce the issue is closed on GitHub, the test will fail with the following error message:\n\n    GitHub issue #119 from 'pyupio/safety' is no longer open. Check if safety \n    can be enabled on Windows. Visit https://github.com/pyupio/safety/issues/119.\n    \n## Issues is closed ...\n\nYou can update the test case to watch if issue is not re-opened. Change the test case from:\n\n    def test_safety_cannot_be_enable_on_windows(self):\n        AssertGitHubIssue(\"pyupio/safety\").is_open(\n            119, \"Check if safety can be enabled on Windows.\"\n        )\n        \nto\n\n    def test_safety_can_be_enable_on_windows(self):\n        AssertGitHubIssue(\"pyupio/safety\").is_closed(\n            119, \"Check if safety should be disabled on Windows.\"\n        )\n\nThe updated test case will now fail if issue gets re-opened.\n\n## ... but fix is not released yet\n\nTo watch for the fix to be released, you can add a release watch test.\n\n### I don't know which version will contain the fix\n\nAssuming that there are 25 releases at the moment of writing the test:\n\n    def test_safety_fix_has_not_been_released(self):\n        AssertGitHubIssue(\"pyupio/safety\").current_release(25)\n        \nIf you're not sure how many releases there are at the moment, you can leave the release number empty:\n\n    def test_safety_fix_has_not_been_released(self):\n        AssertGitHubIssue(\"pyupio/safety\").current_release()\n        \nand the test will report it in the failing test:\n\n    This test does not have any number of releases set. Current number of releases is '25'.\n\n### I know the version of a release that will contain the fix\n\nSometimes the maintainer will mention which release will include the fix. Let's assume the release will be `2.0.0`. To get notified about it, use:\n\n    def test_safety_fix_has_not_been_released(self):\n        AssertGitHubIssue(\"pyupio/safety\").fixed_in(\"2.0.0\")\n        \n## Fix is released\n        \nOnce a new release is available, the test above will fail with:\n\n    New release of 'pyupio/safety' is available. Expected 25 releases but 26 are\n    now available. Visit https://github.com/pyupio/safety/releases.\n\nor\n\n    Release '2.0.0' of 'pyupio/safety' is available. Latest version is\n    '2.2.4'. Visit https://github.com/pyupio/safety/releases.\n    \nNow you can remove the tech debt and the release test case. However, keep the issue status test case to check for a regression.\n\n# Environment variables\n\n`GITHUB_USER_NAME`, `GITHUB_PERSONAL_ACCESS_TOKEN`: Set to GitHub user name and [personal access token](https://github.com/settings/tokens) to raise API limit from 60 requests/hour for a host to 5000 requests/hour on that API key.\n\n`CACHE_INVALIDATION_IN_SECONDS`: Set to number of seconds for invalidating cached data retrieved from HTTP calls. Default value is `3600` seconds (1 day). Use `0` to disable caching. This is useful if you run tests frequently to speed them up and prevent API quota depletion.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python test cases watching when an issue is closed and failing a test to let you know fixed functionality is available.",
    "version": "5.0.0",
    "split_keywords": [
        "pytest",
        "github",
        "issues",
        "testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "166dd3484e21b60468633d21144c50c5",
                "sha256": "489de0d37fe634e205be273abbc3ee0cca0a3b20d4267eb636869dae711ea195"
            },
            "downloads": -1,
            "filename": "issue_watcher-5.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "166dd3484e21b60468633d21144c50c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.2,<=3.11",
            "size": 9047,
            "upload_time": "2022-12-30T10:00:36",
            "upload_time_iso_8601": "2022-12-30T10:00:36.574503Z",
            "url": "https://files.pythonhosted.org/packages/9e/e8/bba06119cb104d14d9adf39ecdef15471873dd8d59c31c0190338474edcb/issue_watcher-5.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "2ee0eb16cb477f54806aad0e55311eb6",
                "sha256": "40c1fdac810a9e2ecff6abd90c1967e41123713d9ef853494d548aab2eb81dab"
            },
            "downloads": -1,
            "filename": "issue_watcher-5.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2ee0eb16cb477f54806aad0e55311eb6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.2,<=3.11",
            "size": 10686,
            "upload_time": "2022-12-30T10:00:37",
            "upload_time_iso_8601": "2022-12-30T10:00:37.751094Z",
            "url": "https://files.pythonhosted.org/packages/2f/d2/89982c18fb5f151085adf2627100d56436ca7ca22bf60c1d6ef90a239a4a/issue_watcher-5.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-30 10:00:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "radeklat",
    "github_project": "issue-watcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "lcname": "issue-watcher"
}
        
Elapsed time: 0.02457s