Skip to content

Commit 823d728

Browse files
julien-langCopilot
andauthored
SG-38773 Fix testing instructions not working on Max versions 2026 & 2022 (shotgunsoftware#55)
* Fix testing instructions not working on Max versions 2026 & 2022 Also improve the overall README to make tests as painless to run as possible * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update tests/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fixup! Fix testing instructions not working on Max versions 2026 & 2022 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent bbaeb96 commit 823d728

3 files changed

Lines changed: 77 additions & 20 deletions

File tree

tests/README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,53 @@ you must be on Windows with 3dsMax installed.
55

66
To run these tests, you need to do the following
77

8-
1. Make sure the following tk repositories are clone in the same base folder as
9-
this one:
10-
* tk-core
11-
* tk-multi-publish2
12-
* tk-framework-shotgunutils
13-
* tk-framework-qtwidgets
14-
15-
In general, anything defined in `tests/fixtures/config/env/test.yml`
16-
17-
1. From a PowerShell terminal, create a virtual environment at `tests/venv`
18-
```ps1
19-
& "C:\Program Files\Autodesk\3ds Max {version}\Python\python.exe" -m venv tests/venv
20-
```
21-
22-
1. Install all dependencies needed for the test:
23-
```ps1
24-
tests\venv\Scripts\pip install -U -r tests\requirements.txt
25-
```
8+
1. From a PowerShell terminal, in the tk-3dsmax git clone folder:
9+
1. Make sure the **following** tk repositories are cloned in the same base
10+
folder as this one:
11+
* tk-core
12+
* tk-multi-publish2
13+
* tk-framework-shotgunutils
14+
* tk-framework-qtwidgets
15+
16+
> **Note**
17+
>
18+
> In general, anything defined in `tests/fixtures/config/env/test.yml`
19+
20+
Also make sure those repositories are up-to-date.
21+
22+
One way to do all this is to run the
23+
[prepare-test-repos.ps1](./prepare-test-repos.ps1) script:
24+
25+
```ps1
26+
tests\prepare-test-repos.ps1
27+
```
28+
29+
1. Set the `$max_version` variable to the tested version of Max:
30+
```ps1
31+
$max_version="2025"
32+
```
33+
34+
1. From a PowerShell terminal, create a virtual environment at `tests/venv`
35+
```ps1
36+
& "C:\Program Files\Autodesk\3ds Max $($max_version)\Python\python.exe" -m venv --clear tests/venv
37+
```
38+
39+
1. Install the `wheel` package:
40+
```ps1
41+
tests\venv\Scripts\pip install -U wheel
42+
```
43+
44+
1. Install all dependencies needed for the test:
45+
```ps1
46+
tests\venv\Scripts\pip install -U -r tests\requirements.txt
47+
```
2648
2749
1. Launch 3dsmax from the Windows shortcut (not from FPTR Desktop)
2850
1. Go to the "**Scripting**" menu → select "**Scripting Listener**"
2951
1. "**File**" → "**Run Script**"
3052
1. Browse to `tests/run_tests.py`
3153
32-
Note that after running the tests about a dozen time or so, the 3dsMax session seems to be getting corrupted and Toolkit's module importer fails at resolving the location of our bundles.
54+
> [!NOTE]
55+
> After running the tests about a dozen time or so, the 3dsMax session seems to
56+
> be getting corrupted and Toolkit's module importer fails at resolving the
57+
> location of our bundles.

tests/prepare-test-repos.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
$repos = @(
2+
"tk-core"
3+
"tk-framework-qtwidgets"
4+
"tk-framework-shotgunutils"
5+
"tk-multi-publish2"
6+
)
7+
8+
foreach ($repo in $repos) {
9+
Write-Host
10+
Write-Host
11+
Write-Host "### Updating $repo"
12+
Write-Host
13+
14+
# if not present, clone the repo
15+
if (-not (Test-Path "../$repo")) {
16+
Write-Host "$repo does not exist, cloning"
17+
git remote -v | Select-String -Pattern "origin\s+(.+)\s+\(fetch\)" | ForEach-Object {
18+
$baseUrl = [System.IO.Path]::GetDirectoryName($_.Matches[0].Groups[1].Value)
19+
}
20+
21+
git clone "$baseUrl/$repo.git" "../$repo"
22+
}
23+
else {
24+
Write-Host "$repo already exists, pulling latest changes"
25+
git -C "../$repo" fetch
26+
git -C "../$repo" checkout .
27+
git -C "../$repo" clean -f -d -x .
28+
git -C "../$repo" switch master
29+
git -C "../$repo" merge
30+
}
31+
32+
git -C "../$repo" clean -f -d -x .
33+
}

tests/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
https://github.com/shotgunsoftware/tk-toolchain/archive/master.zip
2-
wheel ; python_version >= '3.11'

0 commit comments

Comments
 (0)