Skip to content

Commit 4adc11e

Browse files
committed
Add fixture for waiting for PaperWM
1 parent e9fe9f9 commit 4adc11e

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

tests/features/basic.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ Feature: The test machine starts
77
When the machine starts
88
Then the machine should reach graphics
99

10+
@fixture.shell
1011
Scenario: Three finger swipe (stub)
1112
When the user performs three-finger-swipe

tests/features/environment.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from types import SimpleNamespace
22
from pathlib import Path
3+
from behave import fixture, use_fixture
34

45
class NixOSNamespace(SimpleNamespace):
56
''' Derived version of SimpleNamespace, helps unpack our NixOS test objects
@@ -34,9 +35,26 @@ def wait_for_paperwm(self):
3435
'''
3536
return self.machine.wait_until_succeeds(self._gjs_cmdline('paperwm.findModule("tiling").spaces._initDone'))
3637

38+
@fixture
39+
def shell(context):
40+
''' Wait for PaperWM to start
41+
42+
### Wait, why do we need to specify which tests need PaperWM?
43+
44+
If we want to be able to assume given settings when PaperWM starts, we need
45+
to have already updated dconf with them by the time GNOME has finished
46+
loading, meaning the steps altering dconf cannot wait for the Shell.
47+
48+
The first Scenario should then make configuration assumptions, which the
49+
rest of the feature will be able to inherit.
50+
'''
51+
context.nixos.wait_for_paperwm()
52+
53+
def before_tag(context, tag):
54+
if tag == "fixture.shell":
55+
use_fixture(shell, context)
56+
3757
def before_all(context):
38-
''' Wait until PaperWM is actually running
58+
''' Populate the context with NixOS test objects
3959
'''
40-
print("Waiting for PaperWM...")
4160
context.nixos = NixOSNamespace(context)
42-
context.nixos.wait_for_paperwm()

0 commit comments

Comments
 (0)