Merge branch 'main' into LoadPipelineFromGitHub
This commit is contained in:
@@ -24,7 +24,7 @@ from . import common
|
||||
pytest.param({'fake': 'foo'}, True, id="TestSuccess"),
|
||||
pytest.param(None, False, id="TestFail")
|
||||
])
|
||||
def test_determine_dev_root(tmpdir, engine_json_content, expected_success):
|
||||
def test_determine_engine_root(tmpdir, engine_json_content, expected_success):
|
||||
|
||||
test_folder_heirarchy = 'dev/foo1/foo2/foo3/'
|
||||
tmpdir.ensure(test_folder_heirarchy)
|
||||
@@ -40,7 +40,7 @@ def test_determine_dev_root(tmpdir, engine_json_content, expected_success):
|
||||
expected_path = None
|
||||
|
||||
starting_path = str(tmpdir.join(test_folder_heirarchy).realpath())
|
||||
result = common.determine_dev_root(starting_path)
|
||||
result = common.determine_engine_root(starting_path)
|
||||
|
||||
if expected_path:
|
||||
assert os.path.normcase(result) == os.path.normcase(expected_path)
|
||||
@@ -49,7 +49,7 @@ def test_determine_dev_root(tmpdir, engine_json_content, expected_success):
|
||||
|
||||
|
||||
TEST_BOOTSTRAP_CONTENT_1 = """
|
||||
sys_game_folder = Game1
|
||||
project_path = Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
@@ -58,7 +58,7 @@ assets = pc
|
||||
"""
|
||||
|
||||
TEST_BOOTSTRAP_CONTENT_2 = """
|
||||
sys_game_folder = Game2
|
||||
project_path = Game2
|
||||
foo = bar
|
||||
#-------------------------
|
||||
key1 = value1
|
||||
@@ -70,12 +70,12 @@ assets = pc
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"contents, input_keys, expected_result_map", [
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, ['sys_game_folder', 'foo', 'assets'], {'sys_game_folder': 'Game1',
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, ['project_path', 'foo', 'assets'], {'project_path': 'Game1',
|
||||
'foo': 'bar',
|
||||
'assets': 'pc'}, id="TestFullMatch"),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['sys_game_folder', 'foo', 'barnone'], {'sys_game_folder': 'Game2',
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['project_path', 'foo', 'barnone'], {'project_path': 'Game2',
|
||||
'foo': 'bar'}, id="TestPartialMatch"),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['sys_game_foldernone', 'foonone', 'barnone'], {}, id="TestNoMatch")
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['project_pathnone', 'foonone', 'barnone'], {}, id="TestNoMatch")
|
||||
]
|
||||
)
|
||||
def test_get_bootstrap_values_success(tmpdir, contents, input_keys, expected_result_map):
|
||||
@@ -223,9 +223,9 @@ subjectB = ${subject_B_value}
|
||||
|
||||
TEST_GAME_PROJECT_JSON_FORMAT = """
|
||||
{{
|
||||
"project_name": "{game_name}",
|
||||
"product_name": "{game_name}",
|
||||
"executable_name": "{game_name}.GameLauncher",
|
||||
"project_name": "{project_name}",
|
||||
"product_name": "{project_name}",
|
||||
"executable_name": "{project_name}.GameLauncher",
|
||||
"modules" : [],
|
||||
"project_id": "{{4F3363D3-4A7C-47A6-B464-B21524771358}}",
|
||||
|
||||
@@ -244,7 +244,7 @@ def test_verify_game_project_and_dev_root_success(tmpdir):
|
||||
dev_root = 'dev'
|
||||
game_name = 'MyFoo'
|
||||
game_folder = 'myfoo'
|
||||
game_project_json = TEST_GAME_PROJECT_JSON_FORMAT.format(game_name=game_name)
|
||||
game_project_json = TEST_GAME_PROJECT_JSON_FORMAT.format(project_name=game_name)
|
||||
tmpdir.ensure(f'{dev_root}/bootstrap.cfg')
|
||||
tmpdir.ensure(f'{dev_root}/{game_folder}/project.json')
|
||||
project_json_path = tmpdir / dev_root / game_folder / 'project.json'
|
||||
@@ -285,7 +285,7 @@ asset_deploy_type={test_asset_deploy_type}
|
||||
assert result.asset_deploy_type == test_asset_deploy_type
|
||||
|
||||
|
||||
def test_transform_bootstrap_sysgamefolder(tmpdir):
|
||||
def test_transform_bootstrap_project_path(tmpdir):
|
||||
|
||||
tmpdir.ensure('bootstrap.cfg')
|
||||
|
||||
@@ -293,7 +293,7 @@ def test_transform_bootstrap_sysgamefolder(tmpdir):
|
||||
-- Blah Blah
|
||||
-- Blah Blah
|
||||
|
||||
sys_game_folder=OldProject
|
||||
project_path=OldProject
|
||||
|
||||
-- remote_filesystem - enable Virtual File System (VFS)
|
||||
-- This feature allows a remote instance of the game to run off assets
|
||||
@@ -307,53 +307,19 @@ remote_filesystem=0
|
||||
test_dst_bootstrap = tmpdir / 'bootstrap.transformed.cfg'
|
||||
test_game_name = 'FooBar'
|
||||
|
||||
common.transform_bootstrap_for_game(game_name=test_game_name,
|
||||
common.transform_bootstrap_for_project(game_name=test_game_name,
|
||||
src_bootstrap=str(test_src_bootstrap),
|
||||
dst_bootstrap=str(test_dst_bootstrap))
|
||||
|
||||
transformed_text = test_dst_bootstrap.read_text('ascii')
|
||||
|
||||
search_gamename = re.search(r"sys_game_folder\s*=\s*(.*)", transformed_text)
|
||||
search_gamename = re.search(r"project_path\s*=\s*(.*)", transformed_text)
|
||||
assert search_gamename
|
||||
assert search_gamename.group(1)
|
||||
assert search_gamename.group(1) == test_game_name
|
||||
|
||||
|
||||
def test_transform_bootstrap_sysgamename(tmpdir):
|
||||
|
||||
tmpdir.ensure('bootstrap.cfg')
|
||||
|
||||
test_bootstrap_content = """
|
||||
-- Blah Blah
|
||||
-- Blah Blah
|
||||
|
||||
sys_game_name=OldProject
|
||||
|
||||
-- remote_filesystem - enable Virtual File System (VFS)
|
||||
-- This feature allows a remote instance of the game to run off assets
|
||||
-- on the asset processor computers cache instead of deploying them the remote device
|
||||
-- By default it is off and can be overridden for any platform
|
||||
remote_filesystem=0
|
||||
"""
|
||||
test_src_bootstrap = tmpdir / 'bootstrap.cfg'
|
||||
test_src_bootstrap.write_text(test_bootstrap_content, encoding='ascii')
|
||||
|
||||
test_dst_bootstrap = tmpdir / 'bootstrap.transformed.cfg'
|
||||
test_game_name = 'FooBar'
|
||||
|
||||
common.transform_bootstrap_for_game(game_name=test_game_name,
|
||||
src_bootstrap=str(test_src_bootstrap),
|
||||
dst_bootstrap=str(test_dst_bootstrap))
|
||||
|
||||
transformed_text = test_dst_bootstrap.read_text('ascii')
|
||||
|
||||
search_gamename = re.search(r"sys_game_name\s*=\s*(.*)", transformed_text)
|
||||
assert search_gamename
|
||||
assert search_gamename.group(1)
|
||||
assert search_gamename.group(1) == test_game_name
|
||||
|
||||
|
||||
def test_transform_bootstrap_sysgamefolder_missing(tmpdir):
|
||||
def test_transform_bootstrap_project_path_missing(tmpdir):
|
||||
|
||||
tmpdir.ensure('bootstrap.cfg')
|
||||
|
||||
@@ -373,13 +339,13 @@ remote_filesystem=0
|
||||
test_dst_bootstrap = tmpdir / 'bootstrap.transformed.cfg'
|
||||
test_game_name = 'FooBar'
|
||||
|
||||
common.transform_bootstrap_for_game(game_name=test_game_name,
|
||||
common.transform_bootstrap_for_project(game_name=test_game_name,
|
||||
src_bootstrap=str(test_src_bootstrap),
|
||||
dst_bootstrap=str(test_dst_bootstrap))
|
||||
|
||||
transformed_text = test_dst_bootstrap.read_text('ascii')
|
||||
|
||||
search_gamename = re.search(r"sys_game_folder\s*=\s*(.*)", transformed_text)
|
||||
search_gamename = re.search(r"project_path\s*=\s*(.*)", transformed_text)
|
||||
assert search_gamename
|
||||
assert search_gamename.group(1)
|
||||
assert search_gamename.group(1) == test_game_name
|
||||
|
||||
Reference in New Issue
Block a user