release-engineering / pubtools-pulplib

A Pulp library for publishing tools
GNU General Public License v3.0
2 stars 24 forks source link

Make ModulemdUnit and ModulemdDefaultUnit profiles immutable #184

Closed amcmahon-rh closed 2 years ago

amcmahon-rh commented 2 years ago

The profiles value for ModulemdUnit and ModulemdDefaultUnit was a dict type, which ment the value was mutable. This made it dangerous to use these classes in threads and to hash them. This change replaces the dict type with frozendict, which is an implementation of an immutable dictionary. Frozendict is only implemented for python3 so naturally the change will only be available in python3. We assume that people using this library will test their code against python3 so it will catch any cases where they try to modify a value in profiles.

codecov[bot] commented 2 years ago

Codecov Report

Merging #184 (83920e8) into master (9945411) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 83920e8 differs from pull request most recent head 7d80197. Consider uploading reports for the commit 7d80197 to get more accurate results

@@            Coverage Diff            @@
##            master      #184   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           46        47    +1     
  Lines         2829      2845   +16     
=========================================
+ Hits          2829      2845   +16     
Impacted Files Coverage Δ
pubtools/pulplib/_impl/compat_frozendict.py 100.00% <100.00%> (ø)
pubtools/pulplib/_impl/model/convert.py 100.00% <100.00%> (ø)
pubtools/pulplib/_impl/model/unit/modulemd.py 100.00% <100.00%> (ø)
...ools/pulplib/_impl/model/unit/modulemd_defaults.py 100.00% <100.00%> (ø)
pubtools/pulplib/_impl/model/validate.py 100.00% <100.00%> (ø)

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 9945411...7d80197. Read the comment docs.

rohanpm commented 2 years ago

Looks good, can you please rebase/squash it into a single commit now?