chore: refactor training job tests to configure temp test directory#1254
Merged
Conversation
ucdmkt
approved these changes
May 25, 2022
Comment on lines
+77
to
+78
| _TEST_TEMPDIR = tempfile.mkdtemp() | ||
| _TEST_LOCAL_SCRIPT_FILE_PATH = os.path.join(_TEST_TEMPDIR, _TEST_LOCAL_SCRIPT_FILE_NAME) |
Contributor
There was a problem hiding this comment.
Do you think you can afford dependency on absl-py? If so, standardizing on tmp dir handling, with ability to inject via a public envvar, is beneficial.
https://github.com/abseil/abseil-py/blob/main/absl/testing/absltest.py#L158-L165
Alternatively, pytest also has a built in fixture to do so in a standard way , but I understand that I misspoke on this one. pytest is used only for test driver, but not as a unittest utility framework as it is now, so it will be anyways additional dependency.pytest is also used as utility.
https://docs.pytest.org/en/6.2.x/tmpdir.html#base-temporary-directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactored
test_training_jobs.pyto include a temp directory for the test Python script file. This will allow the unit tests to run on different environments.