Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: make integ tests generalized to 2024+ #188

Open
wants to merge 1 commit into
base: mainline
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ keyshot-openjd daemon stop \
1. `export KEYSHOT_EXECUTABLE=<keyshot_headless location>` on Linux and MacOS.
1. Default in MacOS user installs: `/Applications/Keyshot.app/Contents/MacOS/bin/keyshot_headless`
1. Ensure licensing is available on your machine for KeyShot
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)
1. Open a `hatch shell` (paths won't resolve proeprly without this)
1. Run `hatch run integ:test` in the shell
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.
1. Run `hatch run integ:test`

#### Running the Adaptor on a Farm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def main():
raise OSError(
"KeyShotClient cannot connect to the Adaptor because the server path defined by "
"the environment variable KEYSHOT_ADAPTOR_SERVER_PATH does not exist. Got: "
f"{os.environ['KEYSHOT_ADAPTOR_SERVER_PATH']}"
f"{server_path}"
)

client = KeyShotClient(server_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def construct_job_template(filename: str) -> dict:
},
},
},
}
},
],
"script": {
"embeddedFiles": [
Expand Down
54 changes: 27 additions & 27 deletions test/integ/cube/expected_bundle/parameter_values.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"parameterValues": [
{
"name": "Frames",
"value": "0"
},
{
"name": "OutputFilePath",
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\scene.%d.png"
},
{
"name": "OutputFormat",
"value": "PNG"
},
{
"name": "KeyShotFile",
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\actual_bundle\\unpack\\scene.bip"
},
{
"name": "CondaPackages",
"value": "keyshot=2023.* keyshot-openjd=0.3.*"
},
{
"name": "CondaChannels",
"value": "deadline-cloud"
}
]
{
"parameterValues": [
{
"name": "Frames",
"value": "0"
},
{
"name": "OutputFilePath",
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\scene.%d.png"
},
{
"name": "OutputFormat",
"value": "PNG"
},
{
"name": "KeyShotFile",
"value": "PATH_TO_BE_REPLACED\\deadline-cloud-for-keyshot\\test\\integ\\cube\\actual_bundle\\unpack\\scene.bip"
},
{
"name": "CondaPackages",
"value": "keyshot=2024.* keyshot-openjd=0.3.*"
},
{
"name": "CondaChannels",
"value": "deadline-cloud"
}
]
}
22 changes: 20 additions & 2 deletions test/integ/helpers/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,19 @@ def run_keyshot_adaptor_test(
job_params.pop("CondaChannels", None)
job_params.pop("CondaPackages", None)

os.environ["DEADLINE_CLOUD_PYTHONPATH"] = ";".join(
[str(Path(__file__).parent.parent.parent.parent / "src")]
paths_to_add_to_deadline_cloud_pythonpath = [
str(Path(__file__).parent.parent.parent.parent / "src"), # deadline import
]
if "VIRTUAL_ENV" in os.environ:
# VIRTUAL_ENV env var comes from hatch env
paths_to_add_to_deadline_cloud_pythonpath.append(
str(
Path(os.environ["VIRTUAL_ENV"]).parent / "integ" / "Lib" / "site-packages"
) # openjd import
)

os.environ["DEADLINE_CLOUD_PYTHONPATH"] = os.pathsep.join(
paths_to_add_to_deadline_cloud_pythonpath
)

for step in template["steps"]:
Expand Down Expand Up @@ -161,6 +172,13 @@ def assert_expected_job_bundle_and_generated_job_bundle_are_equal(
content1 = content1.replace("PATH_TO_BE_REPLACED", prefix_path)
content1 = replace_backslashes(content1)
content2 = replace_backslashes(content2)
if file == "parameter_values.json":
# generalize to all versions of KeyShot and the adaptor
content2 = re.sub(
r"keyshot=202[3-9].\* keyshot-openjd=0.\d.\*",
"keyshot=2024.* keyshot-openjd=0.3.*",
content2,
)

content1_loaded = json.loads(content1)
content2_loaded = json.loads(content2)
Expand Down