chevah / compat

Chevah OS Compatibility Layer
Other
4 stars 1 forks source link

Add support for stacked cleanups. #112

Closed adiroiban closed 3 years ago

adiroiban commented 3 years ago

Scope

This add support for calling cleanup based on stacks/layers.

This is used by our chevah/server tests in which we have a shared service layer that is used by multiple tests.

Changes

Add a simple enterCleanup/exitCleanup APi for cleanup layers.

As a drive-by change I have updated the IPv4 and IPv6 mocks to return an IP address and not a hostname.

How to try and test the changes

reviewers: @danuker

check that changes make sense and they can be used in chevah/server

adiroiban commented 3 years ago

Thanks for the review. I think that we can add a context manager, but these are low-level method and would like to keep them. But yes, a context manager could make it easier to use.

I would loved to add auto-release on tag...but this is a public repo without access to our VPN.

I will update the context manager and will release it.

danuker commented 3 years ago

Works and looks good! Thank you. Feel free to merge and release.

Edit: Wait: not yet. there may be something going on with the order of cleanups. The issue is with my code, not compat. Feel free to merge.

adiroiban commented 3 years ago

Released Submitting dist/chevah_compat-0.61.0-py2-none-any.whl to http://deag.chevah.com:10042 Server response (200): OK

codecov[bot] commented 3 years ago

Codecov Report

Merging #112 (7e1acc0) into master (c9b0980) will decrease coverage by 1.19%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   88.77%   87.57%   -1.20%     
==========================================
  Files          58       58              
  Lines        7829     7887      +58     
  Branches      652      652              
==========================================
- Hits         6950     6907      -43     
- Misses        677      767      +90     
- Partials      202      213      +11     
Impacted Files Coverage Δ
chevah/compat/testing/mockup.py 84.45% <100.00%> (ø)
chevah/compat/testing/testcase.py 79.32% <100.00%> (+0.82%) :arrow_up:
chevah/compat/tests/normal/testing/test_mockup.py 97.72% <100.00%> (+0.16%) :arrow_up:
...hevah/compat/tests/normal/testing/test_testcase.py 99.48% <100.00%> (-0.52%) :arrow_down:
chevah/compat/unix_filesystem.py 95.27% <100.00%> (ø)
chevah/compat/tests/normal/test_capabilities.py 47.56% <0.00%> (-31.90%) :arrow_down:
chevah/compat/tests/elevated/__init__.py 61.90% <0.00%> (-19.05%) :arrow_down:
chevah/compat/unix_capabilities.py 88.57% <0.00%> (-5.72%) :arrow_down:
chevah/compat/capabilities.py 57.89% <0.00%> (-5.27%) :arrow_down:
chevah/compat/tests/elevated/test_capabilities.py 84.84% <0.00%> (-4.55%) :arrow_down:
... and 12 more