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

Ensure that the tests find the built python module vs an install #4411

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kdt3rd
Copy link
Contributor

@kdt3rd kdt3rd commented Sep 8, 2024

This may have a slightly messy un-intended consequence of "snap-shotting" pythonpath when configured in a large python env, but eases testing confusion on systems where pythonpath is not yet set, but an (older) copy of OpenImageIO is installed.

This fixes the python tests on my home machine.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • If I added or modified a C++ API call, I have also amended the
    corresponding Python bindings (and if altering ImageBufAlgo functions, also
    exposed the new functionality as oiiotool options).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

…lled one

This may have a slightly messy un-intended consequence of
"snap-shotting" pythonpath when configured in a large python env, but
eases testing confusion on systems where pythonpath is not yet set, but
an (older) copy of OpenImageIO is installed.

Signed-off-by: Kimball Thurston <[email protected]>
Copy link

linux-foundation-easycla bot commented Sep 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@@ -110,6 +110,7 @@ macro (oiio_add_tests)
"OIIO_TESTSUITE_ROOT=${_testsuite}"
"OIIO_TESTSUITE_SRC=${_testsrcdir}"
"OIIO_TESTSUITE_CUR=${_testdir}"
"PYTHONPATH=${CMAKE_BINARY_DIR}/lib/python/site-packages:$ENV{PYTHONPATH}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the fact that you used : here account for the Windows CI failures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely, switching to use generator expression which should be fine in cmake 3.14+ - the pathListSep config variable is not available until 3.24 or somesuch

Also adds python version and init.py to build tree such that windows has
a chance of working with the DLL loading

Signed-off-by: Kimball Thurston <[email protected]>
@kdt3rd
Copy link
Contributor Author

kdt3rd commented Sep 14, 2024

With the latest commit, I can cleanly run the test target from the build folder (assuming I have previously downloaded the test images) without running an install, which eases the development workflow. I do not have a windows machine to test with, but windows (and ninja multiconfig) have multiple configs, so to avoid potential slicing, put the python modules in the appropriate config path - and copied the init.py in there such that it might work to load the dlls under windows (untested). Given that the CI runs the tests using the installed dist tree, I have disabled overriding the env variables in this scenario

Comment on lines +118 to +122
if (NOT DEFINED ENV{OpenImageIO_ROOT})
# this will ensure the appropriate fonts are found
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
"OpenImageIO_ROOT=${CMAKE_SOURCE_DIR}/src")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure I understand all the implications -- now or after future changes we aren't considering -- of setting OpenImageIO_ROOT to point to the src directory, of all places.

And what happens if somebody is building in an environment where OpenImageIO_ROOT is already set to someplace other than this build area (maybe to an existing install)? In that case, this would not be set, and what would that mean?

Wouldn't it be more direct to set OPENIMAGEIO_FONTS to exactly the right spot? And much less likely to affect absolutely anything else?

Also, sorry about this nit, but would you mind using 4-space indentation like the surrounding code? Thanks.

@lgritz lgritz changed the title Ensure that the tests find the built python python module vs an install Ensure that the tests find the built python module vs an install Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants