File: test_event_exceptions.py

package info (click to toggle)
python-i3ipc 2.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 580 kB
  • sloc: python: 2,968; makefile: 222; sh: 4
file content (21 lines) | stat: -rw-r--r-- 447 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from ipctest import IpcTest

from threading import Timer
import pytest


class HandlerException(Exception):
    pass


class TestEventExceptions(IpcTest):
    def exception_throwing_handler(self, i3, e):
        raise HandlerException()

    def test_event_exceptions(self, i3):
        i3.on('tick', self.exception_throwing_handler)

        Timer(0.001, i3.send_tick).start()

        with pytest.raises(HandlerException):
            i3.main()