Add logging levels to update script#582
Open
mariaclara-sia wants to merge 3 commits intomainfrom
Open
Conversation
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.
CHANGELOG.mdwith relevant non-documentation file changes?The update script presents users with information of varying importance using print statements. Issue #428 states how difficult this can make the output to parse. This PR replaces those print statements with logging calls. Manual tests are described below.
Manual tests
New
logging.warning()andlogging.info()calls were introduced to replace print statements in the update script of the starter-pack. The command-line tests below demonstrate how these calls are reached. Each test is independent of other tests.Prerequisite for tests
Clone this branch of the starter-pack.
Change to the starter-pack's
docsdirectory and runmake html, then activate the resulting Python virtual environment.From inside the virtual environment, change to the
.sphinxsubdirectory and run the update script. The script should run with no issues.Test 1: Missing version file (Lines 47-48)
Temporarily rename the the
versionfile so that the update script fails to find it in the expected place. (Triggers: lines 47-48)Run the update script. Warnings are shown.
To clean up, restore the original
versionfile.Test 2: Outdated starter-pack version, missing files (Lines 101 / 64, 149, 80-81, 86-88, 94-96)
Set the
LOG_INFOenvironment variable toTrue, which sets the update script's logging level toINFO. SinceINFOis a higher level thanDEBUG, the pre-existinglogging.debug()calls will be skipped, resulting in cleaner log output.Run the update script normally. Log info is shown (line 101).
Temporarily replace the existing
versionfile with one that declares the version to be "0.1" The update script assumes the starter-pack is outdated. (Triggers: lines 64, 149, 80-81, 86-88)Temporarily rename the
pa11y.jsonfile (one of a few monitored files) so that the update script fails to find it in the expected place. (Triggers: lines 94-96 + creation of some new files)Run the update script. Warnings and log info are shown.
To clean up, remove newly created files and restore the original
pa11y.jsonfile. Delete the 0.1versionfile and restore the originalversionfile. Finally, unset theLOG_INFOenvironment variable.Test 3: Missing requirements.txt file (Lines 127-29)
Temporarily rename the
../requirements.txtfile so that the update script fails to find it in the expected place. (Triggers: lines 127-129)Run the update script. Warnings are shown.
To clean up, restore the original
../requirements.txtfile.Test 4: Missing dependencies in
requirements.txt(Line 123)Temporarily comment out the last line of
../requirements.txt(prepend a hash "# "). This omits one dependency (in this case,vale) from the set of dependencies that the update script extracts from the.txtfile. (Triggers: line 123)Run the update script. Warnings are shown.
To clean up, uncomment the last line of
../requirements.txt(remove the prepended hash "# ").Clean up after tests
Exit the virtual environment.