| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Taffybar.Test.DBusSpec
Synopsis
- spec :: Spec
- withTestDBus :: IO a -> IO a
- withTestDBusInDir :: FilePath -> IO a -> IO a
- data Bus
- withDBusDaemon_ :: Bus -> FilePath -> IO a -> IO a
- withConnectDBusDaemon :: Bus -> FilePath -> (Client -> IO a) -> IO a
- withConnectDBusDaemon' :: Bus -> FilePath -> (Address -> Client -> IO a) -> IO a
- setDBusEnv :: Bus -> Address -> ProcessConfig i o e -> ProcessConfig i o e
- withBusEnv :: Bus -> Address -> IO a -> IO a
- withPythonDBusMock :: Bus -> (Address, Client) -> BusName -> ObjectPath -> InterfaceName -> IO a -> IO a
- withTaffyMocks :: IO a -> IO a
- withMatch :: MonadUnliftIO m => Client -> MatchRule -> (Signal -> m ()) -> m a -> m a
- withClient :: Address -> (Client -> IO a) -> IO a
Documentation
Start private D-Busses for testing
withTestDBus :: IO a -> IO a Source #
Same as withTestDBusInDir, except that it creates and removes the
temporary directory for you.
Uses withDBusDaemon_ to provide both a private session bus and
a private system bus while the given action is running.
The DBUS_SESSION_BUS_ADDRESS and DBUS_SYSTEM_BUS_ADDRESS
environment variables will be set to point to socket files within
the given directory.
Files in the directory will be left behind after this function returns.
Note: Environment variables are global to the process, so be
careful using this with parallel unit tests.
withDBusDaemon_ :: Bus -> FilePath -> IO a -> IO a Source #
Start a D-Bus daemon of the given Bus type, and set the
corresponding environment variable while running the given action.
Note: Environment variables are global to the process, so be
careful using this with parallel unit tests. A safer option could
be withConnectDBusDaemon' and setBusEnv.
withConnectDBusDaemon' :: Bus -> FilePath -> (Address -> Client -> IO a) -> IO a Source #
Same as withDBusDaemon, but it also provides a Client
connection.
Using the private D-Bus
setDBusEnv :: Bus -> Address -> ProcessConfig i o e -> ProcessConfig i o e Source #
Adjust a ProcessConfig so that the child process will use the
given D-Bus address.
withBusEnv :: Bus -> Address -> IO a -> IO a Source #
Set the DBUS_SESSION_BUS_ADDRESS or DBUS_SYSTEM_BUS_ADDRESS
environment variable according to the given bus and address.
Note 1: Environment variables are global to the process, so
be careful using this with parallel unit tests.
Note 2. Using a DBUS_SYSTEM_BUS_ADDRESS environment variable to set a
custom system bus address is supported by libdbus (therefore
python-dbus) and haskell-dbus, but not necessarily other libraries
or programs. Notably, systemd hardcodes the system bus address.
python-dbusmock Services
Arguments
| :: Bus |
|
| -> (Address, Client) | Connection to the |
| -> BusName | Name of mock service. |
| -> ObjectPath | Path of mock service. |
| -> InterfaceName | Interface of mock service. |
| -> IO a | |
| -> IO a |
Starts up python-dbusmock.
The given action will be run once the mock is ready.
withTaffyMocks :: IO a -> IO a Source #