9 Commits
Author SHA1 Message Date
Aleksandr Motsjonov c8f2c70b54 python/testing: Improve python test coverage (#5260)
While working on
https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/5254,
where we're introducing changes that could surface bugs in pybind11 code
that's in production today, I figured I'd try adding some tests.

This was a fairly loose-handed effort. To be upfront: most of it was
LLM-generated. I did some research into which modules were lacking
coverage the most, and those are what this PR targets. I haven't gone
through every line of the generated code.

I hate being asked to review something that was clearly vibe-coded with
no real effort put in, so I'm saying that here rather than pretending
otherwise. I can try to review it properly, but without deep codebase
knowledge it'll be slow and painful. Since these are just tests, my
thinking was: even if there are silly bits here and there, it shouldn't
hurt much, as long as things go green and we cover more logic and
branches. Worth offering as-is.

---------

Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
2026-07-04 18:32:26 -07:00
Chad Dombrova e787dc6ef1 feat: Add python stub files (#4692)
Add python stub files for code completion and static analysis.

Fixes
https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4682

No new test cases, since there is not any change to the behavior. I do
have an idea for a kind of test that might validate the stubs against
the python unit tests, but I don't know if it's worth it.

---------

Signed-off-by: Chad Dombrova <chadrik@gmail.com>
2025-05-13 18:09:01 -07:00
Larry Gritz 8799aedabd build!: Move to Python 3.7 minimum (#4200)
These are build-breaking changes that impose a variety of new minimum
dependencies for the toolchain.

The new minimum Python version supported is now 3.7.

Get rid of 'from future' lines in python scripts in testsuite.

Remove python 2.7 specific ref images from testsuite.

Needless to say, this will not be backported to any release branches,
which guarantee that they will never raise the minimum supported
versions of any dependencies. This is just for future OIIO.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-05 07:50:46 -07:00
Larry Gritz ef3c02a0df admin: Repo rename -- fix all URL references (#3998)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-29 16:27:13 -07:00
Larry Gritz 1fa2bb1a8b feat(python): Implement ImageCache.get_imagespec() (#3982)
This C++ method of ImageCache was never exposed previously.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-12 11:58:30 -07:00
Larry Gritz eda748ef0e admin: update licensing (#3903)
Since LG has re-licensed all his old code under Apache-2.0, we can
change the license notice from BSD to Apache-2.0 for all files in which
LG is the only extant author. Also change all files that LG co-authored
with other people to specify "BSD-3-Clause and Apache-2.0".

Some files (mostly test scripts) had no license notice, so in those
cases, we added one.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-05 21:32:04 -04:00
Larry Gritz b4dad279a9 Additional testing and improved code coverage (and minor fixes) (#3745)
* Better Typedesc testing of 'tostring' with fmt style formatting
  commands, and fix a bug that uncovered.

* Refine 'make CODECOV=1' behavior

* Beef up python-imagecache test to test getpixels, more attribute,
  invalidate.

* Better testing of python IB construction from numpy array.

* testtex: Use correct guard to avoid compiling unused code for
  coverage analysis testtex: get rid of unused 3d warp code.

* Add texture-threadtimes test

* Eliminate redundant code in exroutput.c by implementing
  write_scanline using write_scanlines.
2023-01-08 14:17:43 -08:00
Larry Gritz 9b41418941 IC and TS getattributetype() (#3559)
ImageSpec and ParamValueList have had (since 2.1) a getattributetype()
method, which simply returns the TypeDesc of the named attribute, or
TypeUnknown if no such attribute exits. This goes along well with the
related getattribute() and attribute() family of methods.

The getattribute() method was not present in ImageCache and
TextureSystem, despite their having very similar
getattribute()/attribute() interfaces.

A recent issue made me realize that in the Python bindings, the IC and
TS bindings for `getattribute(name)` did not work properly, always
returning None, and *required* you to use the full
`getattribute(name,type)` variety where you have to supply -- and
already know -- the type. This isn't especially Pythonic, where you
should just be able to ask by name and get a polymorphic result. And
when I went to look at how to repair this, it was going to be very
awkward without getattributetype(), but trivial with it.

So this patch sets up getattributetype() for both IC and TS, and
exposes them to both C++ and Python APIs, and also fully fixes the
getattribute() so that it works properly with the name only.

Unfortunately, because getattributename is a new virtual method, it
changes the vtable, breaking the ABI, and thus cannot be backported to
any supported release that makes ABI compatibility promises.
2022-09-22 22:56:11 -07:00
Larry Gritz a2e7ec714f Python: add ability to getattribute of int64 and uint64 data (#3555)
Just a couple missing pieces were preventing getattribute() from
retrieving attributes that were stored as int64 or uint64. That
doesn't come up very often, but one place is retrieving certain
statistics that use 64 bit counters. (This comes up in ImageCache,
among other places.)

While we're at it, there was no existing test dedicated to the python
binding of ImageCache. So to add these getattribute calls, I made one.

There is an important caveat about ImageCache.getattribute(): In this
process, I discovered that the flavor of IC.getattribute(name) where
you only pass the name is BROKEN, and will always return None. You
MUST use the form where you pass the type, like

    x = ic.getattribute("foo", "int")

This is unfortunate and not very Pythonic, but it is the workaround
for now. I will addess getting the name-only form working in a
separate PR.

Closes #3537
2022-09-16 15:23:36 -07:00