refactor: refactor pybmap test
This commit is contained in:
40
Assets/BMapBindings/pybmap/tests/cli.py
Normal file
40
Assets/BMapBindings/pybmap/tests/cli.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
class CliException(Exception):
|
||||
"""Error occurs when parsing test arguments."""
|
||||
pass
|
||||
|
||||
class Cli:
|
||||
|
||||
file_name: Path
|
||||
"""
|
||||
The path to the map for loading.
|
||||
"""
|
||||
ballance_dir: Path
|
||||
"""
|
||||
The path to the Ballance directory for finding textures
|
||||
"""
|
||||
encodings: tuple[str, ...]
|
||||
"""
|
||||
The name of encodings used by BMap for loading map.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
file_name = os.environ.get('BMAP_FILE_NAME', None)
|
||||
if file_name is None:
|
||||
raise CliException('You must specify BMAP_FILE_NAME environment variable before running this test.')
|
||||
else:
|
||||
self.file_name = Path(file_name).resolve()
|
||||
|
||||
ballance_dir = os.environ.get('BMAP_BALLANCE_DIR', None)
|
||||
if ballance_dir is None:
|
||||
raise CliException('You must specify BMAP_BALLANCE_DIR environment variable before running this test.')
|
||||
else:
|
||||
self.ballance_dir = Path(ballance_dir).resolve()
|
||||
|
||||
encodings = os.environ.get('BMAP_ENCODINGS', None)
|
||||
if encodings is None:
|
||||
raise CliException('You must specify BMAP_ENCODINGS environment variable before running this test.')
|
||||
else:
|
||||
self.encodings = tuple(encodings.split(','))
|
||||
Reference in New Issue
Block a user