Skip to content

Conversation

@apetrynet
Copy link
Contributor

I moved the creation and deletion of the temp files and corresponding file descriptors in setUp() and tearDown() methods.

I suspect I've done something stupid in my merging of the upstream code, thus all the previous commits are tagging along in this PR. Please let me know if I should close this PR and start over. I think I did my previous change directly in the imagesequence branch and not a feature branch based on it. That might be what's causing this.
Apologize if this causes head aches.

apetrynet referenced this pull request Jan 14, 2020
* * Added initial support for `ImageSequenceReference`

* * Added sample otio file with `ImageSequenceReference`
* Added test for creating an rv session file with the sample file above

* * Use the `frame_zero_padding` from the `ImageSequenceReference` in stead of `start_frame` for frame substitution base

* * renamed _in and _out variables

* * lint fix
@codecov-io
Copy link

codecov-io commented Jan 14, 2020

Codecov Report

Merging #638 into imagesequence will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##           imagesequence     #638   +/-   ##
==============================================
  Coverage          83.04%   83.04%           
==============================================
  Files                 74       74           
  Lines               2860     2860           
==============================================
  Hits                2375     2375           
  Misses               485      485
Flag Coverage Δ
#py27 82.95% <ø> (ø) ⬆️
#py36 83.02% <ø> (ø) ⬆️
#py37 83.02% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1445b7c...2c65d81. Read the comment docs.

Copy link
Collaborator

@reinecke reinecke left a comment

Choose a reason for hiding this comment

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

Is it possible to avoid putting this in setUp and tearDown? It creates an implicit behavior of giving every test a tempfile whether or not it's using it.

Would the NamedTemporaryFile do what you're looking for:

with tempfile.NamedTemporaryFile("w+t", suffix=".rv") as temp:
    otio.adapters.write_to_file(timeline, temp.name)
    temp.seek(0)
    test_data = temp.read()

This keeps the code easier to reason about locally and allows more complex tests to operate on multiple temporary files.

@reinecke
Copy link
Collaborator

I'll update my comment because I just caught up with the thread on the original PR.
That windows caveat @darbyjohnston brought up is a good one. I'd still like to see this done a little more locally though. Could using the TemporaryDirectory context manager work? Within that dir you may name files whatever you like then.

@apetrynet
Copy link
Contributor Author

OK, I'll give it a go.

@apetrynet
Copy link
Contributor Author

Hmm. TemporaryDirectory isn't available in python2.7 and for some reason the RV adapter only works with python2.
I'll still find another approach.

Copy link
Collaborator

@reinecke reinecke left a comment

Choose a reason for hiding this comment

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

Given that the context managers are each painful in their own respect, I think your approach is reasonable.
I had just a few nitpicks but overall looks good!

* Removed redundant assertions as suggested in PR comments
Copy link
Collaborator

@reinecke reinecke left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for resolving this!

@jminor jminor merged commit 1a7e65d into AcademySoftwareFoundation:imagesequence Jan 28, 2020
@ssteinbach ssteinbach added this to the Public Beta 13 milestone Mar 17, 2020
reinecke pushed a commit that referenced this pull request May 28, 2020
* * create and delete temp file and file descriptors through `setUp()` and `tearDown()` methods to prevent fd leak
* * Close tmp file descriptor in `setUp()` to avoid trouble in Windows
* Removed redundant assertions as suggested in PR comments
@apetrynet apetrynet deleted the update_rvsession_tests branch October 9, 2025 20:24
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.

5 participants