analogdevicesinc / pyadi-iio

Python interfaces for ADI hardware with IIO drivers (aka peyote)
https://analogdevicesinc.github.io/pyadi-iio
Other
134 stars 99 forks source link

test/attr_tests: fix tests with setattr #482

Closed dlech closed 9 months ago

dlech commented 9 months ago

Description

Since Python objects will dynamically add an attribute if one does not exist when calling setattr(), we need to check that the attribute actually exists before setting it. Otherwise, tests will pass even if the attribute is not defined in the object being tested.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

How has this been tested?

While developing #474, I noticed that tests were passing when I had an obvious mistake. Applying this fix caught the mistake.

Documentation

If this is a new feature or example please mention or link any documentation. All new hardware interface classes require documentation.

Checklist:

github-actions[bot] commented 9 months ago

Unit Test Results

1 249 tests  ±0      247 :heavy_check_mark: ±0   5m 12s :stopwatch: +8s        1 suites ±0   1 002 :zzz: ±0         1 files   ±0          0 :x: ±0 

Results for commit fa0404ff. ± Comparison against base commit 301a5f5c.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 9 months ago

Generated documentation for this PR is available at Link