Skip to content

tests: Drop uhid reference to avoid failures due to "too many open files"

Jason Gerecke requested to merge jigpu/hid-tools:fix-EMFILE into master

Each test we run results in pytest running the TestUhid.context method as a test fixture to set up the uhid device for testing. When execution resumes after the yield statment, the test has finished and the device is no longer needed. Unfortunately, even though the test has finished pytest appears to retain a reference to the TestUhid object, and it in turn retains a reference to the device. This reference prevents the fd from being closed, and so at some point every test begins to fail because we can't open any more file handles.

Releasing our reference to the uhid device after the test is complete is sufficient to break this reference chain and allow the GC to call the destructor and close the file.

Signed-off-by: Jason Gerecke jason.gerecke@wacom.com

Edited by Jason Gerecke

Merge request reports