From 35f5af7b5d8506f7df9a11af5a2e0bb3581d5451 Mon Sep 17 00:00:00 2001
From: hagrid67 <jdhwatson@gmail.com>
Date: Sun, 19 May 2019 13:57:21 +0100
Subject: [PATCH] try using xvfb-run inside Makefile for coverage (which runs
 py.test) and in tox.ini for [testenv] which runs py.test

---
 Makefile | 9 +--------
 tox.ini  | 4 ++--
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 267bef13..e107ec0a 100644
--- a/Makefile
+++ b/Makefile
@@ -53,22 +53,15 @@ clean-test: ## remove test and coverage artifacts
 lint: ## check style with flake8
 	flake8 flatland tests
 
-test:	export DISPLAY = :0
 test: ## run tests quickly with the default Python
 	echo "$$DISPLAY"
 	py.test
 
-
-jw: 	export DISPLAY = :0.0
-jw:
-	echo "$$DISPLAY"
-	py.test
-
 test-all: ## run tests on every Python version with tox
 	tox
 
 coverage: ## check code coverage quickly with the default Python
-	coverage run --source flatland -m pytest
+	xvfb-run coverage run --source flatland -m pytest
 	coverage report -m
 	coverage html
 	$(BROWSER) htmlcov/index.html
diff --git a/tox.ini b/tox.ini
index 7b8636e6..768d58db 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,7 +28,6 @@ commands = make coverage
 [testenv]
 setenv =
     PYTHONPATH = {toxinidir}
-    DISPLAY = :0
 deps =
     -r{toxinidir}/requirements_dev.txt
 ; If you want to make tox run the tests with the same versions, create a
@@ -36,6 +35,7 @@ deps =
 ;     -r{toxinidir}/requirements.txt
 commands =
     pip install -U pip
-    py.test --basetemp={envtmpdir}
+    sh -c 'echo DISPLAY: $DISPLAY'
+    xvfb-run py.test --basetemp={envtmpdir}
 
 
-- 
GitLab