Giter VIP home page Giter VIP logo

pytest-osxnotify's Introduction

pytest-osxnotify

PyPI PyPI
Demo

A py.test plugin that displays test results using native Mac OS X notifications (NSUserNotification). Works with Python 2.7 and 3.3+ on Mountain Lion or better.

Usage

$ pip install pytest-osxnotify
$ py.test

How to test a change to the plugin

$ virtualenv venv && . venv/bin/activate
$ pip install pytest -r requirements.txt
$ python setup.py install
$ venv/bin/py.test --traceconfig example_test.py -p pytest_osxnotify

How to submit a new release to PyPi

$ git tag X.Y.Z -m "Release X.Y.Z"
$ git push --tags
$ python setup.py sdist upload -r pypi

Changelog

  • 0.1.7
    • Tweaked the notification delay to ensure that success/error messages are displayed.

Meta

Daniel Bader โ€“ @dbader_org โ€“ [email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/dbader/pytest-osxnotify

pytest-osxnotify's People

Contributors

dbader avatar jremes-foss avatar rygwdn avatar temoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pytest-osxnotify's Issues

Reports no test run on xpass

It's unclear whether pytest reports a difference between xfail(run=True) and xfail(run=False) (aka "the test failed as expected" versus "test was expected to fail and we didn't even run it), but xpass (test was expected to fail yet succeeded) seems like it should be considered a test which has been run.

required built-in appearance SystemAppearance not found

I'm getting hard app crash in calling the native module. Anyone seen this before?

$ py.test -f .
============================= test session starts ==============================
platform darwin -- Python 2.7.9 -- py-1.4.30 -- pytest-2.7.2
rootdir: [redacted], inifile:
plugins: cov, osxnotify, xdist, xdist, xdist
Traceback (most recent call last):
  File "/usr/local/bin/py.test", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/_pytest/config.py", line 41, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
    return self._docall(self.methods, kwargs)
  File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
    firstresult=self.firstresult).execute()
  File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
    res = method(*args)
  File "/usr/local/lib/python2.7/site-packages/xdist/looponfail.py", line 24, in pytest_cmdline_main
    looponfail_main(config)
  File "/usr/local/lib/python2.7/site-packages/xdist/looponfail.py", line 35, in looponfail_main
    remotecontrol.loop_once()
  File "/usr/local/lib/python2.7/site-packages/xdist/looponfail.py", line 102, in loop_once
    result = self.runsession()
  File "/usr/local/lib/python2.7/site-packages/xdist/looponfail.py", line 91, in runsession
    return self.channel.receive()
  File "/usr/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 737, in receive
    raise self._getremoteerror() or EOFError()
EOFError: couldnt load message header, expected 9 bytes, got 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Critical error: required built-in appearance SystemAppearance not found'
abort() called
terminating with uncaught exception of type NSException

Yosemite Python 3.4 swizzle getattr() attribute name must be string

Hello. Please tell if I can fix this with some quick patch.

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/_pytest/main.py", line 82, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/pytest_osxnotify/__init__.py", line 27, in pytest_sessionstart
INTERNALERROR>     notify('py.test', 'Running tests...')
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/pytest_osxnotify/__init__.py", line 78, in notify
INTERNALERROR>     swizzled_bundleIdentifier)
INTERNALERROR>   File "/.../venv/lib/python3.4/site-packages/pytest_osxnotify/__init__.py", line 52, in swizzle
INTERNALERROR>     old_IMP = getattr(cls, SEL, None)
INTERNALERROR> TypeError: getattr(): attribute name must be string

% uname -a
Darwin leebook 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64

% venv/bin/python --version
Python 3.4.3

% venv/bin/pip freeze
py==1.4.26
pyobjc-core==3.0.4
pytest==2.6.4
pytest-osxnotify==0.1.5   # master ce865a7536abdf67f4b6dec8aa5952ce4f707dc2

Parameter `--osxnotify` is hard to negate

The only way I know to pass bool(False) with the current implementation is to pass in an empty string: osxnotify='' -- argparse does no implicit cast from str to bool other than the default Python truth test for empty sequences. So one must either write a str2bool function or add a --no-osxnotify option, using argparse.add_argument's action='store_true' and action='store_false'.

Or maybe drop the option altogether and let it be disabled with -p no:osxnotify once #9 is fixed.

Typo in entrypoints

In setup.py, the pytest11 entrypoint is called pyest_osxnotify -- note the missing "t".

You might also consider naming the entrypoint just "osxnotify". The one place that I know this is used for this plugin is disabling it from the command-line: Currently one has to use -p no:pyest_osxnotify; it would be more conventional to be able to use -p no:osxnotify.

Release 0.1.5

To do:

  • Give credit for recent PRs
  • Bump version
  • Release to PyPI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.