Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save the original subprocess.Popen before mocking it #2340

Merged
merged 1 commit into from
Aug 25, 2021

Conversation

narrieta
Copy link
Member

The firewalll tests need the value of subprocess.Popen before other tests mock it (in case those tests run in parallel)

@@ -1105,7 +1107,7 @@ def _test_run_latest(self, mock_child=None, mock_time=None, child_args=None):
if mock_time is None:
mock_time = TimeMock()

with patch('subprocess.Popen', return_value=mock_child) as mock_popen:
with patch('azurelinuxagent.ga.update.subprocess.Popen', return_value=mock_child) as mock_popen:
Copy link
Member Author

Choose a reason for hiding this comment

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

this doesn't change the behavior of the tests, but is more explicit as to what we intent to mock

@codecov
Copy link

codecov bot commented Aug 24, 2021

Codecov Report

Merging #2340 (45a62af) into develop (5f0dee5) will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2340      +/-   ##
===========================================
+ Coverage    70.86%   70.90%   +0.03%     
===========================================
  Files           97       97              
  Lines        14105    14105              
  Branches      2029     2029              
===========================================
+ Hits          9996    10001       +5     
+ Misses        3662     3660       -2     
+ Partials       447      444       -3     
Impacted Files Coverage Δ
azurelinuxagent/ga/collect_telemetry_events.py 91.43% <0.00%> (+1.71%) ⬆️

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 5f0dee5...45a62af. Read the comment docs.

@narrieta narrieta merged commit 9e73d01 into Azure:develop Aug 25, 2021
@narrieta narrieta deleted the update-tests branch August 25, 2021 18:17
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.

3 participants