-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pytest configuration to display custom environment information
- Loading branch information
1 parent
0c3b43c
commit 328cd76
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import shutil | ||
|
||
def pytest_configure(config): | ||
""" | ||
A pytest hook to customize the terminal summary. | ||
""" | ||
# Get the environment variable | ||
mermaid_server = os.getenv("MERMAID_INK_SERVER", "Not Set") | ||
|
||
mermaid_server = f"\033[92m{mermaid_server}\033[0m" if mermaid_server != "Not Set" else f"\033[91mNot Set\033[0m" | ||
# Print the environment variable at the start | ||
word = " Custom Environment Information " | ||
line = word.center(shutil.get_terminal_size(fallback=(80, 20))[0], "=") | ||
print(f"\033[1m{line}\033[0m") | ||
print(f"\033[92mMERMAID_INK_SERVER \033[0m: {mermaid_server}") |
This file contains 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