Browse Source

fix tests for no X environment

Bastien Sevajol 6 years ago
parent
commit
65b0f6ef24
2 changed files with 3 additions and 4 deletions
  1. 2 3
      synergine2_cocos2d/middleware.py
  2. 1 1
      tests/test_tmx.py

+ 2 - 3
synergine2_cocos2d/middleware.py View File

5
 from xml.etree import ElementTree
5
 from xml.etree import ElementTree
6
 from xml.etree.ElementTree import Element
6
 from xml.etree.ElementTree import Element
7
 
7
 
8
-from cocos.tiles import Resource
9
-
10
 from synergine2.config import Config
8
 from synergine2.config import Config
11
 from synergine2.log import get_logger
9
 from synergine2.log import get_logger
12
 from synergine2_cocos2d.util import get_map_file_path_from_dir
10
 from synergine2_cocos2d.util import get_map_file_path_from_dir
13
 
11
 
14
 if typing.TYPE_CHECKING:
12
 if typing.TYPE_CHECKING:
15
     import cocos
13
     import cocos
14
+    from cocos.tiles import Resource
16
 
15
 
17
 
16
 
18
 class MapLoader(object):
17
 class MapLoader(object):
19
-    def load(self, map_file_path: str) -> Resource:
18
+    def load(self, map_file_path: str) -> 'Resource':
20
         # import cocos here for prevent test crash when no X server is
19
         # import cocos here for prevent test crash when no X server is
21
         # present
20
         # present
22
         import cocos
21
         import cocos

+ 1 - 1
tests/test_tmx.py View File

57
         tileset_content = loader.get_sanitized_tileset_content(
57
         tileset_content = loader.get_sanitized_tileset_content(
58
             'tests/fixtures/terrain.tsx',
58
             'tests/fixtures/terrain.tsx',
59
         )
59
         )
60
-        assert 'source="tests/fixtures/terrain.png"' in tileset_content
60
+        assert 'source="tests/fixtures/terrain.png"' in