From 1fdae873e823e4174c8c18b4f3ec600d81416704 Mon Sep 17 00:00:00 2001 From: hagrid67 <jdhwatson@gmail.com> Date: Sat, 18 May 2019 17:36:53 +0100 Subject: [PATCH] set DISPLAY in tox.ini for tk tests with window --- Makefile | 9 ++++++++- flatland/utils/graphics_pil.py | 2 +- tox.ini | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5149780..267bef1 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +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 - export DISPLAY=:0.0 + echo "$$DISPLAY" + py.test + + +jw: export DISPLAY = :0.0 +jw: + echo "$$DISPLAY" py.test test-all: ## run tests on every Python version with tox diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index ceda3fd..b66c8dc 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -86,7 +86,7 @@ class PILGL(GraphicsLayer): def create_layer(self, iLayer=0): if len(self.layers) <= iLayer: for i in range(len(self.layers), iLayer+1): - if i==0: + if i == 0: opacity = 255 # "bottom" layer is opaque (for rails) else: opacity = 0 # subsequent layers are transparent diff --git a/tox.ini b/tox.ini index 5a97b7e..7b8636e 100644 --- a/tox.ini +++ b/tox.ini @@ -28,6 +28,7 @@ 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 -- GitLab