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.
What I changed
webbrowser.open_new()so headless/CI prints the URL instead of throwing.Files
jarviscli/plugins/personality.pyjarviscli/tests/test_personality_plugin.pyWhy
Running the
personalityplugin crashed after showing the type:The code stored the type as a list (e.g.,
['I','N','F','J']) and then called.lower()on it when formatting the URL. Joining once into a string fixes this and makes the URL deterministic.How it works
self.type_str = ''.join(self.type)after scoring.https://www.16personalities.com/{self.type_str.lower()}-personality.webbrowser.open_new(url), and on exception (e.g., headless), print the URL so the session continues gracefully.How to test
Automated
The test:
INFJ.webbrowser.open_newand asserts it was called with:https://www.16personalities.com/infj-personality.Manual (optional)
Answer the prompts; you should see the four-letter result and your browser should open (or the URL prints in headless environments).
Backward compatibility
Notes
os.path.join(FILE_PATH, ...).