Skip to content

Commit a1aed07

Browse files
committed
test: make integ tests generalized to 2024+
Signed-off-by: Joel Wong <[email protected]>
1 parent 8c5da03 commit a1aed07

File tree

5 files changed

+51
-34
lines changed

5 files changed

+51
-34
lines changed

DEVELOPMENT.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ keyshot-openjd daemon stop \
181181
1. `export KEYSHOT_EXECUTABLE=<keyshot_headless location>` on Linux and MacOS.
182182
1. Default in MacOS user installs: `/Applications/Keyshot.app/Contents/MacOS/bin/keyshot_headless`
183183
1. Ensure licensing is available on your machine for KeyShot
184-
1. Download [Python 3.11.9](https://www.python.org/downloads/release/python-3119/) and do a system install of it (C:\Program Files\Python311 on Windows)
185-
1. Open a `hatch shell` (paths won't resolve proeprly without this)
186-
1. Run `hatch run integ:test` in the shell
184+
1. Download [Python 3.11.9](https://www.python.org/downloads/release/python-3119/) and do a system install of it (C:\Program Files\Python311 on Windows). This is required because the KeyShot Python is missing some standard libraries used by the adaptor but will automatically pull them from the installed Python 3.11.
185+
1. Run `hatch run integ:test`
187186

188187
#### Running the Adaptor on a Farm
189188

src/deadline/keyshot_adaptor/KeyShotClient/keyshot_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def main():
6767
raise OSError(
6868
"KeyShotClient cannot connect to the Adaptor because the server path defined by "
6969
"the environment variable KEYSHOT_ADAPTOR_SERVER_PATH does not exist. Got: "
70-
f"{os.environ['KEYSHOT_ADAPTOR_SERVER_PATH']}"
70+
f"{server_path}"
7171
)
7272

7373
client = KeyShotClient(server_path)

src/deadline/keyshot_submitter/Submit to AWS Deadline Cloud.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def construct_job_template(filename: str) -> dict:
218218
},
219219
},
220220
},
221-
}
221+
},
222222
],
223223
"script": {
224224
"embeddedFiles": [
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
{
2-
"parameterValues": [
3-
{
4-
"name": "Frames",
5-
"value": "0"
6-
},
7-
{
8-
"name": "OutputFilePath",
9-
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\scene.%d.png"
10-
},
11-
{
12-
"name": "OutputFormat",
13-
"value": "PNG"
14-
},
15-
{
16-
"name": "KeyShotFile",
17-
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\actual_bundle\\unpack\\scene.bip"
18-
},
19-
{
20-
"name": "CondaPackages",
21-
"value": "keyshot=2023.* keyshot-openjd=0.3.*"
22-
},
23-
{
24-
"name": "CondaChannels",
25-
"value": "deadline-cloud"
26-
}
27-
]
1+
{
2+
"parameterValues": [
3+
{
4+
"name": "Frames",
5+
"value": "0"
6+
},
7+
{
8+
"name": "OutputFilePath",
9+
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\scene.%d.png"
10+
},
11+
{
12+
"name": "OutputFormat",
13+
"value": "PNG"
14+
},
15+
{
16+
"name": "KeyShotFile",
17+
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\actual_bundle\\unpack\\scene.bip"
18+
},
19+
{
20+
"name": "CondaPackages",
21+
"value": "keyshot=2024.* keyshot-openjd=0.3.*"
22+
},
23+
{
24+
"name": "CondaChannels",
25+
"value": "deadline-cloud"
26+
}
27+
]
2828
}

test/integ/helpers/test_runners.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,19 @@ def run_keyshot_adaptor_test(
7474
job_params.pop("CondaChannels", None)
7575
job_params.pop("CondaPackages", None)
7676

77-
os.environ["DEADLINE_CLOUD_PYTHONPATH"] = ";".join(
78-
[str(Path(__file__).parent.parent.parent.parent / "src")]
77+
paths_to_add_to_deadline_cloud_pythonpath = [
78+
str(Path(__file__).parent.parent.parent.parent / "src"), # deadline import
79+
]
80+
if "VIRTUAL_ENV" in os.environ:
81+
# VIRTUAL_ENV env var comes from hatch env
82+
paths_to_add_to_deadline_cloud_pythonpath.append(
83+
str(
84+
Path(os.environ["VIRTUAL_ENV"]).parent / "integ" / "Lib" / "site-packages"
85+
) # openjd import
86+
)
87+
88+
os.environ["DEADLINE_CLOUD_PYTHONPATH"] = os.pathsep.join(
89+
paths_to_add_to_deadline_cloud_pythonpath
7990
)
8091

8192
for step in template["steps"]:
@@ -161,6 +172,13 @@ def assert_expected_job_bundle_and_generated_job_bundle_are_equal(
161172
content1 = content1.replace("PATH_TO_BE_REPLACED", prefix_path)
162173
content1 = replace_backslashes(content1)
163174
content2 = replace_backslashes(content2)
175+
if file == "parameter_values.json":
176+
# generalize to all versions of KeyShot and the adaptor
177+
content2 = re.sub(
178+
r"keyshot=202[3-9].\* keyshot-openjd=0.\d.\*",
179+
"keyshot=2024.* keyshot-openjd=0.3.*",
180+
content2,
181+
)
164182

165183
content1_loaded = json.loads(content1)
166184
content2_loaded = json.loads(content2)

0 commit comments

Comments
 (0)