Skip to content

Commit

Permalink
feat: add pytest configuration to display custom environment information
Browse files Browse the repository at this point in the history
  • Loading branch information
ouhammmourachid committed Nov 25, 2024
1 parent 0c3b43c commit 328cd76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 16 additions & 0 deletions tests/conftest.py
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}")
2 changes: 0 additions & 2 deletions tests/test_statediagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ def test_concurrent_with_sub_goups(self):
\tfirst_state : First State
\t[*] --> first_state
}"""
print(expect_string)
print(concurrent)
self.assertEqual(expect_string, str(concurrent))

def test_concurrent_with_sub_goups_and_styles(self):
Expand Down

0 comments on commit 328cd76

Please sign in to comment.