taffybar-4.1.1: A desktop bar similar to xmobar, but with more GUI
Safe HaskellNone
LanguageHaskell2010

System.Taffybar.Test.DBusSpec

Synopsis

Documentation

spec :: Spec Source #

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.

withTestDBusInDir Source #

Arguments

:: FilePath

Directory for config files and sockets.

-> IO a 
-> IO a 

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.

data Bus Source #

Constructors

Session 
System 

Instances

Instances details
Enum Bus Source # 
Instance details

Defined in System.Taffybar.Test.DBusSpec

Read Bus Source # 
Instance details

Defined in System.Taffybar.Test.DBusSpec

Show Bus Source # 
Instance details

Defined in System.Taffybar.Test.DBusSpec

Eq Bus Source # 
Instance details

Defined in System.Taffybar.Test.DBusSpec

Methods

(==) :: Bus -> Bus -> Bool Source #

(/=) :: Bus -> Bus -> Bool Source #

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

withPythonDBusMock Source #

Arguments

:: Bus

python-dbusmock wants to know which bus.

-> (Address, Client)

Connection to the Bus

-> 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.

Utils

withMatch :: MonadUnliftIO m => Client -> MatchRule -> (Signal -> m ()) -> m a -> m a Source #

withClient :: Address -> (Client -> IO a) -> IO a Source #