Skip to content

Renamed packaging.py to packaging_metadata.py (Bugfix)#944

Merged
kissiel merged 3 commits intomainfrom
rename-packaging-metadata-file
Jan 22, 2024
Merged

Renamed packaging.py to packaging_metadata.py (Bugfix)#944
kissiel merged 3 commits intomainfrom
rename-packaging-metadata-file

Conversation

@fernando79513
Copy link
Copy Markdown
Collaborator

This change was made to avoid naming conflicts when importing the packaging module from packaging.py

Description

When running unit tests using the unittest module we run into an import error:

python3 -m unittest test_packaging.py 

ERROR: test_packaging (unittest.loader._FailedTest.test_packaging)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_packaging
...
  File "/home/pieq/dev/work/checkbox/checkbox-ng/plainbox/impl/unit/packaging.py", line 118, in <module>
    from packaging import version
ImportError: cannot import name 'version' from partially initialized module 'packaging' (most likely due to a circular import) (/home/pieq/dev/work/checkbox/checkbox-ng/plainbox/impl/unit/packaging.py)

This was because the python file had the same name as the module we were importing.

Resolved issues

Documentation

No new Documentation changes

Tests

Running the unit tests works without any issue:

python3 -m unittest test_packaging.py
pytest test_packaging_metadata.py

Running ./manage.py packaging works the same as before. In my case, I had to modify also one of the gitignored files to make it work, checkbox-ng/checkbox_ng.egg-info/entry_points.txt but that should not be necessary if you setup the package again.

@fernando79513 fernando79513 force-pushed the rename-packaging-metadata-file branch from 007111d to 230a996 Compare January 17, 2024 09:45
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f31e500) 39.18% compared to head (3399962) 39.19%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #944      +/-   ##
==========================================
+ Coverage   39.18%   39.19%   +0.01%     
==========================================
  Files         315      315              
  Lines       34899    34899              
  Branches     5972     5972              
==========================================
+ Hits        13676    13680       +4     
+ Misses      20610    20608       -2     
+ Partials      613      611       -2     
Flag Coverage Δ
checkbox-ng 65.33% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This change was made to avoid naming conflicts when importing the packaging module from
packaging.py
@fernando79513 fernando79513 force-pushed the rename-packaging-metadata-file branch from 5f88f94 to 3399962 Compare January 18, 2024 16:24
Copy link
Copy Markdown
Contributor

@kissiel kissiel left a comment

Choose a reason for hiding this comment

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

And the final +1 :)

@kissiel kissiel merged commit 130710d into main Jan 22, 2024
@kissiel kissiel deleted the rename-packaging-metadata-file branch January 22, 2024 15:49
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Mar 20, 2024
* Renamed packaging.py to packaging_metadata.py

This change was made to avoid naming conflicts when importing the packaging module from
packaging.py

* Added tests for category outcome map

* Formatted test state
binli pushed a commit to binli/checkbox that referenced this pull request Mar 22, 2024
* Renamed packaging.py to packaging_metadata.py

This change was made to avoid naming conflicts when importing the packaging module from
packaging.py

* Added tests for category outcome map

* Formatted test state
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.

2 participants