Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal:
windows-latest
to CI github action to ensure tests are passing on all three major platforms before committing to master.Obstacle:
NamedTemporaryFile
works on Linux vs WindowsPermissionError
when trying to accessNamedTemporaryFile
on WindowsSolution:
NamedTemporaryFile
directly. Setup a mockNamedTemporaryFile
calledmock_named_temporary_file
where we handle the creation and tear-down. The key here is to settingdelete=False
. By doing this we can access theNamedTemporaryFile
after creation but the file is not deleted. This is why our mock object handles the tear down ensuring all temp files are deleted.Obstacle:
TemporaryDirectory
works on Linux vs WindowsTemporaryDirectory
Solution:
TemporaryDirectory
. We will only expect a failure when the platform is windows and the python version is < 3.8Obstacle:
test_data/files/file_with_secrets.py
on Linux whiletest_data\\files\\file_with_secrets.py
on WindowsSolution:
pathlib path
module for instantiating paths which handles the platform differencesObstacle:
Solution:
keyword_test.py
, Change the length for the long_line from 40707 characters to 32039 characters