Skip to main content

A pytest plugin for sending a desktop notification and playing a sound upon completion of tests

Project description

Pytest-notification

A plugin for pytest that sends notifications if a --notify flag is passed to pytest on the command line. It plays sounds when a --sound or --play-sound flag is passed.

The notifications and sounds are different depending whether the test run has passed or failed.

The messages and sounds are only played when the flags are passed. This allows you to turn it on only for those tests for which you expect a long time is needed.

Alternatives

pytest-notifier always sends a notification. It can be turned of with --notify-off. This is a fundamentally different design choice, which is why this package was created. Pytest-notifier has been around for a long time and is still being actively maintained. It does not support playing sounds, but it does support Mac OS X notifications.

Usage

option

usage

--notify

Sends a desktop notification when pytest is finished. (Only implemented on Linux. Requires the ‘notify-send’ program in PATH on Linux.

--sound, --play-sound

Plays a sound when pytest is finished. (Only implemented on Linux and Macintosh systems).

--disturb

shorthand for --notify --sound

Installation

pytest-notification can be installed with pip install pytest-notification.

Linux

On Linux notifications are supported via the notify-send program. On Debian, Ubuntu and derived distros this is available in the libnotify-bin package.

On Linux sound is supported via the paplay program. On Debian, Ubuntu and derived distros this available in the pulseaudio-utils pacakge.

The installation for Ubuntu should be:

sudo apt update
sudo apt install libnotify-bin pulseaudio-utils
pip install pytest-notification

Mac OS X

On Mac OS X sound is implemented via the afplay program, which should be installed by default. Since I do not own a mac I can not test this feature. pull requests are welcome.

On Mac OS X notifications are not supported. Alternatively you could take a look at pytest-notifier, which does support Mac OS X.

Windows

Windows is not supported.

Contributing

Pull requests for improved Mac and Windows support are welcome. As well as ideas and other pull requests. Simply create a new issue or PR on the github page.

Windows support

In theory the winsound module could be used to play sounds, but this only supports wave files. These are very big and cumbersome to distribute. I have not actively looked for a way to create a message on windows. There will probably be some powershell command that can pull this off. Pull requests are welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-notification-0.2.0.tar.gz (114.9 kB view details)

Uploaded Source

Built Distribution

pytest_notification-0.2.0-py3-none-any.whl (116.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-notification-0.2.0.tar.gz.

File metadata

  • Download URL: pytest-notification-0.2.0.tar.gz
  • Upload date:
  • Size: 114.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3

File hashes

Hashes for pytest-notification-0.2.0.tar.gz
Algorithm Hash digest
SHA256 86ed95750416a974e00c94e3339eba3147da4666537730ceb9014f60d1bfda1a
MD5 7b2f3fc2b79dbfcc6047e3b3385e3068
BLAKE2b-256 b9af47e9b0a326ac33aa73c965b7f2794ff623d259328eca830942b57ec6bec9

See more details on using hashes here.

File details

Details for the file pytest_notification-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_notification-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 116.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3

File hashes

Hashes for pytest_notification-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62844a290287fdc423aadba9dc4a83a88b1a7830313fd3c2c510355722d45dd4
MD5 64feca42c9dc0a1a2c738d24e5d36557
BLAKE2b-256 37e12a495e9ffb5f113c4bb264f98de0ff4a169652bb9dad5d359a78ed05c8df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page