Skip to content

Commit

Permalink
test: Fix docs test, used wrong namespace (#4090)
Browse files Browse the repository at this point in the history
We did `import OpenImageIO as oiio` then instead of using `oiio`, we
used `OpenImageIO`.

This was failing sometimes. Frankly, I'm not sure why it ever worked.
Maybe it works on some versions of Python but not others?
I dunno. But this fixes it everywhere and is clearly correct.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Jan 2, 2024
1 parent 4cb956b commit 1b63d1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion testsuite/docs-examples-python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

redirect = " >> out.txt 2>&1 "

# Prep:
command += run_app("cmake -E copy " + test_source_dir + "/../common/grid-small.exr grid.exr")
Expand All @@ -12,7 +13,7 @@
# Run the examples for each chapter
for chapter in [ "imageioapi", "imageoutput", "imageinput", "writingplugins",
"imagecache", "texturesys", "imagebuf", "imagebufalgo" ] :
command += pythonbin + " src/docs-examples-" + chapter + ".py >> out.txt ;"
command += pythonbin + " src/docs-examples-" + chapter + ".py " + redirect + " ;"

# hashes merely check that the images don't change, but saves us the space
# of checking in a full copy of the image if it's not needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def example_make_texture():
config["maketx:filtername"] = "lanczos3"
config["maketx:opaque_detect"] = 1

ok = ImageBufAlgo.make_texture (OpenImageIO.MakeTxTexture,
ok = ImageBufAlgo.make_texture (oiio.MakeTxTexture,
Input, "texture.exr", config)
if not ok :
print("make_texture error:", OpenImageIO.geterror())
print("make_texture error:", oiio.geterror())

# END-imagebufalgo-make-texture

Expand Down

0 comments on commit 1b63d1b

Please sign in to comment.