import pytest

import open_cp.gui.tk as tk

def test_screen_size():
    root = tk.tk.Tk()
    w, h = tk.screen_size(root)
    assert((w,h) == (1280,1024))
@@ -37,16 +37,140 @@
  as tk%0A%0A
+@pytest.fixture%0Adef root():%0A    try:%0A        root = tk.tk.Tk()%0A        return root%0A    except tk.tk.TclError:%0A        pass%0A%0A
 def test
@@ -186,32 +186,42 @@
 ize(
+root
 ):%0A    
+if 
 root 
-= tk.tk.Tk()
+is None: return
 %0A   

Allow to work headless